Thanks for the insights. I went ahead and created my own
net.hydromatic.optiq.jdbc.Driver and net.hydromatic.avatica.Handler
implementations in order to have complete control over my connection
management. I wasn't really using the Json model stuff anyway, I had just been
using it since that was what the CSV example used.
-Marc
On Jul 6, 2014, at 5:18 PM, Julian Hyde <[email protected]> wrote:
> It is by design that a schema does not reference an Optiq connection. We
> wanted schemas to be re-usable across connections, so we made it difficult to
> connections to leak into them. A schema is typically created before the first
> connection.
>
> There's nothing wrong with your schema containing a reference to your
> connection. Create a connection to your backend in your schema's
> constructor, based on credentials passed in from SchemaFactory.create, and
> store it as a field of your schema.
>
> This is exactly how MongoSchema does it. Note that MongoTable references
> neither a schema nor a connection, but when a scan is started it creates a
> MongoQueryable, which has both a QueryProvider (which you can down-cast to an
> OptiqConnection) and a SchemaPlus (from which you can access your schema, via
> unwrap).
>
> Julian
>