Last active
January 30, 2022 14:45
-
-
Save qharlie/073c6ed0b81e7d9d8c69d69553538e38 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C:\Users\charl\anaconda3\envs\prql\python.exe C:/Users/charl/workspace/prql/python/src/main.py | |
******************************************************************************** | |
Parsing /../resource/expressions.prql | |
******************************************************************************** | |
from otb_table | |
left_join some_other_table [otb_id=some_id] | |
select [ | |
otb_name, | |
some_other_name, | |
price, | |
qty | |
] | |
filter price > 0 | |
derive [ | |
total_price : price * qty | sum | |
qty_mod : qty * (1 + tax/(32*100)) + 0.05 | |
thrifty : 32 * (qty_mod - qty) + 100 + total_price * 0.05 | |
] | |
filter qty_mod > (200 + total_price * 0.05) | |
filter thrifty <= 200 | |
aggregate by: [otb_name,some_other_name] [ | |
sum price, | |
average price, | |
sum qty, | |
count | |
] | |
sort price | |
take 25 | |
-------------------------------------------------------------------------------- | |
AST: pretty_print(tree) | |
-------------------------------------------------------------------------------- | |
from otb_table | |
join: some_other_table on otb_id = some_id | |
select: ['otb_name', 'some_other_name', 'price', 'qty'] | |
filter: | |
(price > 0) | |
derive: | |
total_price=(price * qty) | sum | |
qty_mod=((qty * (1 + (tax / (32 * 100)))) + 0.05) | |
thrifty=(((32 * (qty_mod - qty)) + 100) + (total_price * 0.05)) | |
filter: | |
(qty_mod > (200 + (total_price * 0.05))) | |
(thrifty <= 200) | |
aggregate: | |
aggregates: ['sum price', 'average price', 'sum qty', 'count all'] | |
group_by: ['otb_name', 'some_other_name'] | |
sort: price | |
take: 25 | |
******************************************************************************** | |
Parsing /../resource/variables.prql | |
******************************************************************************** | |
from employees | |
filter country = "USA" | |
derive [ | |
gross_salary : salary + payroll_tax | |
gross_cost : gross_salary + benefits_cost | |
] | |
filter gross_cost > 0 | |
aggregate by:[title, country] [ | |
average salary, | |
sum salary, | |
average gross_salary, | |
sum gross_salary, | |
count | |
] | |
sort gross_cost | |
filter count > 200 | |
take 20 | |
-------------------------------------------------------------------------------- | |
AST: pretty_print(tree) | |
-------------------------------------------------------------------------------- | |
from employees | |
filter: | |
(country = USA) | |
derive: | |
gross_salary=(salary + payroll_tax) | |
gross_cost=(gross_salary + benefits_cost) | |
filter: | |
(gross_cost > 0) | |
aggregate: | |
aggregates: ['average salary', 'sum salary', 'average gross_salary', 'sum gross_salary', 'count all'] | |
group_by: ['title', 'country'] | |
sort: gross_cost | |
filter: | |
(count > 200) | |
take: 20 | |
******************************************************************************** | |
Parsing /../resource/cte1.prql | |
******************************************************************************** | |
table newest_employees = ( | |
from employees | |
sort tenure | |
take 50 | |
) | |
from newest_employees | |
join salary [id] | |
select [name, salary] | |
-------------------------------------------------------------------------------- | |
AST: pretty_print(tree) | |
-------------------------------------------------------------------------------- | |
with newest_employees from employees: | |
query: ['sort: tenure', 'take: 50'] | |
from newest_employees | |
join: salary on id | |
select: ['name', 'salary'] | |
******************************************************************************** | |
Parsing /../resource/list-equivelance.prql | |
******************************************************************************** | |
from employees | |
select salary | |
-------------------------------------------------------------------------------- | |
AST: pretty_print(tree) | |
-------------------------------------------------------------------------------- | |
from employees | |
select: ['salary'] | |
******************************************************************************** | |
Parsing /../resource/list-equivelance.prql | |
******************************************************************************** | |
from employees | |
select [salary] | |
-------------------------------------------------------------------------------- | |
AST: pretty_print(tree) | |
-------------------------------------------------------------------------------- | |
from employees | |
select: ['salary'] | |
******************************************************************************** | |
Parsing /../resource/list-equivelance.prql | |
******************************************************************************** | |
from employees | |
derive [ | |
gross_salary: salary + payroll_tax, | |
gross_cost: gross_salary + benefits_cost | |
] | |
-------------------------------------------------------------------------------- | |
AST: pretty_print(tree) | |
-------------------------------------------------------------------------------- | |
from employees | |
derive: | |
gross_salary=(salary + payroll_tax) | |
gross_cost=(gross_salary + benefits_cost) | |
******************************************************************************** | |
Parsing /../resource/list-equivelance.prql | |
******************************************************************************** | |
from employees | |
derive gross_salary: salary + payroll_tax | |
derive gross_cost: gross_salary + benefits_cost | |
-------------------------------------------------------------------------------- | |
AST: pretty_print(tree) | |
-------------------------------------------------------------------------------- | |
from employees | |
derive: | |
gross_salary=(salary + payroll_tax) | |
gross_cost=(gross_salary + benefits_cost) | |
Process finished with exit code 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment