SQL cells broken?

I have a notebook which was working Friday and isn’t today.

This is using a Database Proxy. I know the proxy is working fine based on other notebooks using db.query(...-style queries to the same proxy rather than SQL cells.

Just verified that db.query style works for the “broken” notebook. So yeah… something’s up with SQL cells. I did clear cache and reload, too.

Sorry about that! We’re looking into it, but in the meantime we can try to narrow down the issue. One thing that is different about the SQL cell compared to the db.query style is that the SQL cell uses streaming results. Can you try and replace something like

db.query('SELECT ...')

with this streaming equivalent?

{
  let response = await db.queryStream('SELECT ...');
  let vals = [];
  for await (const chunk of response.readRows()) {
    vals = [...vals, ...chunk];
    yield vals;
  }
}

I expect that will break in the same way as the SQL cell, which helps make a more minimal test case.

That worked on the same notebook running the same query where the SQL cell is not working.

apologies for the delay, we’re having a bit of trouble reproducing this issue so we may need some more info from you!

first off, what type of database are you using (Postgres, MySQL, Snowflake)? and would you mind sharing the query that you’re running in the SQL cell?

also, it might help to be able to see the results that you expect from this query. you can get a CSV file of the results if you click “Download CSV” on the cell where you’re running db.query with the same query. if you’re ok with sharing those results, could you send the CSV to support@observablehq.com?

Postgres. I’ll email those things.

Actually I probably don’t need to. It’s working now. No change to anything on my end (notebook, browser, database).

hmm ok, glad that it’s working now! feel free to still email that info to us, you may have uncovered an edge case that we should be aware of.

1 Like