You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey--does this approach (using a mock engine) work?
fromsiuba.sql.utilsimportmock_sqlalchemy_enginefromsiuba.sqlimportLazyTblas_LazyTblcars_sql=_LazyTbl(
mock_sqlalchemy_engine("postgresql"),
"cars",
["cyl", "mpg", "hp"]
)
# example showing the queryfromsiubaimport_, mutate, show_queryq=cars_sql>>mutate(avg=_.hp-_.hp.mean()) >>show_query()
outputs:
SELECTcars.cyl, cars.mpg, cars.hp, cars.hp-avg(cars.hp) OVER () AS avg
FROM cars
Currently, show_query just prints the SQL and returns a LazyTbl, but I can add the equivalent of dbplyr's db_sql_render (or add an argument to show_query to return the generated string)
Could we use LazyTbl without specifying an engine? I just want to use siuba to generate SQL query, similar to what pypika does.
The text was updated successfully, but these errors were encountered: