An ancestor project of Calcite, Eigenbase (aka Farrago) used to have a SET SCHEMA command. It would be nice if we added that back. (Maybe only in the “server” module, since in “core” the connections are stateless.)
I’m a bit surprised that "CalciteConnection.setSchema(String)" doesn’t work. Put a breakpoint in the constructor of CalciteCatalogReader and see what is the value of schemaPaths. That is effectively the default schema for purposes of validating SQL statements. Julian > On Mar 15, 2022, at 11:49 AM, Gavin Ray <ray.gavi...@gmail.com> wrote: > > I have a scenario in which I have a rootSchema that holds multiple > datasource schemas > There's a tool I'd like to integrate it with, but it can't handle (catalog > -> schema -> schema) structure > > I figured an easy way around this would be to iterate the names of the > datasource schemas, and then > and then make a clone of the current CalciteConnection with the > defaultSchema set to <db name> > > I can't seem to figure out how to do this, though. > > Calling .setSchema() doesn't seem to work (probably no impact on the JDBC > metadata) > and if I create a new connection with the "schema" property set, then it's > a fresh/empty Calcite source. > > Is there any way to do this? Or some craft hack? > > Thank you =)