We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am trying to use sqlglot for unit testing complex queries with test case data. However, Casting to 'Type.BOOLEAN' not implemented.
Casting to 'Type.BOOLEAN' not implemented.
from sqlglot.executor import execute tables = { "dates": [ {"duration": "P4Y11M17D"}, {"duration": "P6M1D"}, {"duration": "P8M"}, ], } sql_query = """ SELECT sac.duration, CASE WHEN CAST(POSITION('D' IN duration) AS BOOLEAN) THEN CAST(REGEXP_REPLACE(SUBSTR(duration, POSITION('D' IN duration) -2 , 2), '[^0-9]', '') AS INTEGER) ELSE 0 END as duration_day FROM dates sac """ schema = { "dates": { "duration": "VARCHAR", } } result = execute(sql_query, schema=schema, tables=tables, read='trino') print(result)
Curious if this could be easily supported... any guides on how to support this?
The text was updated successfully, but these errors were encountered:
da51f1e
i wouldn't use sqlglot for unit testing complex queries, it's in a "toy" state. you should probably use duckdb or pyspark
Sorry, something went wrong.
Fix: cast to boolean closes tobymao#1658
dc3db49
No branches or pull requests
I am trying to use sqlglot for unit testing complex queries with test case data.
However,
Casting to 'Type.BOOLEAN' not implemented.
Curious if this could be easily supported... any guides on how to support this?
The text was updated successfully, but these errors were encountered: