Skip to content

Conversation

@ndenev
Copy link
Owner

@ndenev ndenev commented Jan 14, 2026

Summary

  • Add PRQL (Pipelined Relational Query Language) as an alternative to SQL
  • Auto-detection based on syntax - no mode switching needed
  • PRQL queries are compiled to SQL transparently before execution

Example

from pods
filter namespace == "kube-system"
select {name, namespace, created}
sort created
take 10

Equivalent SQL:

SELECT name, namespace, created FROM pods 
WHERE namespace = 'kube-system' 
ORDER BY created LIMIT 10

Implementation

  • Add prqlc = "0.13" dependency
  • New src/datafusion_integration/prql.rs with detection and compilation
  • Integrate into preprocess_sql() which now returns Result<String>
  • Reorder execute_sql: preprocess before validation (PRQL needs compilation first)

Test plan

  • cargo build passes
  • cargo test passes (165 tests)
  • cargo clippy clean
  • Manual testing: k8sql -q "from pods | take 3" works
  • Manual testing: SQL queries still work unchanged

@claude
Copy link

claude bot commented Jan 14, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

PRQL (Pipelined Relational Query Language) is now supported as an
alternative to SQL. Queries are auto-detected based on syntax:

- PRQL: starts with `from`, `let`, or `prql` (after skipping # comments)
- SQL: starts with `SELECT`, `WITH`, `SHOW`, etc.

Example PRQL query:
  from pods | filter namespace == "kube-system" | select {name} | take 5

Implementation:
- Add prqlc dependency for PRQL to SQL compilation
- Create prql.rs module with is_prql() detection and compile_prql()
- Integrate into preprocess_sql() which now returns Result<String>
- Reorder execute_sql: preprocess before validation (PRQL needs
  compilation before SQL validation can occur)
- Handle leading # comments in PRQL detection
@ndenev ndenev force-pushed the prql-integration branch 2 times, most recently from de05df4 to bbd0c7f Compare January 14, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants