Conversation
There was a problem hiding this comment.
This seems to work, at least for this example:
I can interact with it and the Wasm build updates the plot successfully.
However, there is an issue with the following example:
VISUALISE FROM ggsql:airquality
PLACE rect SETTING
xmin => '1973-06-01',
xmax => '1973-06-30',
ymin => 50,
ymax => 100,
colour => 'dodgerblue'
DRAW line MAPPING Date AS x, Temp AS y
Execute error: ReaderError("Failed to prepare SQL: near \"'1970-01-01'\": syntax error in SELECT * FROM (WITH __ggsql_values__(\"pos1min\", \"pos2min\", \"pos1max\", \"pos2max\") AS (VALUES (CAST(DATE '1970-01-01' + INTERVAL 1247 DAY AS DATE), 50, CAST(DATE '1970-01-01' + INTERVAL 1276 DAY AS DATE), 100)) SELECT * FROM __ggsql_values__) AS __schema__ LIMIT 1 at offset 103")
There's a Quarto error in CI, and I don't think that CAST(DATE '1970-01-01' + INTERVAL 1276 DAY AS DATE) is ever going to work in sqlite, since AFAIK it doesn't have real DATE types. We might need to throw an error there instead when running under sqlite and avoid this example, or otherwise accept it will never be interactive even if we fix it :/
|
Then again, I guess we could convert the date to some Rust value and do the required calculation there, if it is just a fixed calculation that we don't need to delegate to the SQL engine to run over billions of rows? |
|
Yeah, this is more an issue with SQLite than with place I think... We can discuss next week, but I think perhaps the SqlDialect should have a temporal module or something. SQLite does have these facilities they are just horrible to look at... |
This PR fixes the query PLACE uses to create its data so that it is universal and works with the SQLite reader (and by extension in the wasm build)