Skip to content
This repository was archived by the owner on Nov 19, 2023. It is now read-only.

Conversation

@aljazerzen
Copy link
Member

No description provided.

@aljazerzen aljazerzen requested a review from snth January 25, 2023 21:08
if query.starts_with("prql ") {
// replace the table placeholders again
for (alias, source) in sources.iter() {
debug!("alias = {alias:?}; source = {source:?}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to look over these changes more and try them out. I know what I had was quite hacky but I think there was a reason for it.

Copy link
Member Author

@aljazerzen aljazerzen Jan 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I try to summarize, you had something like this:

prql_source
  .split_by_lines()
  .insert(
     1, "table source_name = (from a_name = a_key)"
  )
  .join('\n')
  .compile_prql()
  .replace('a_key', "read_csv('source_file.csv')")

I've changed it to:

let pl_stmts = parse(prql_source)
pl_stmts.insert(1, parse("let source_name = s'''read_csv('source_file.csv')'''"))
compile(pl_stmts)

@aljazerzen aljazerzen merged commit 230f09e into main Feb 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants