SQL Cell variable substitution and JavaScript functions

I want the definition of TEAM_SCORE to be inserted into my SQL Cell, but it does not work this way and I’m unsure how to make it work. Can someone please point me in the right direction?

can u share a link to you notebook so we can fork it and edit it and send you a suggestion based on working code.

I don’t think this style of interpolation is supported, unfortunately (although I’m no expert). Observable’s SQL cells follow the Observable DatabaseClient Specification which does not seem to support raw interpolation. Any interpolated value will be replaced by a parameter placeholder.

If you want to dig further to better understand the limitations, you can also take a look at the implementation of the SQLiteDatabaseClient.

1 Like

I think you might be able to call the sql function directly and do the interpolation manually before calling the template literal. (DatabaseClient Specification / Observable / Observable) I am quite interested to see if we can express functions in JS with SQLite. It would not go through the sql cells though. I think we do need a way to bypass the params interpolation though, this is the second usecase for not creating a prepared statement arg on template variables substitution.

1 Like