Using CockroachDB with Gino and Sanic

Hello, I’m using Sanic, Gino which wraps SQLAlchemy and Cockroach labs SQLAlchemy adapter but I’m having problems connecting to the cluster.

The problem here is that the adapter is not compatible with Gino since Gino adds a concept called “Strategy” in the connection process and that requires the DB dialect to have a method named init_pool and the CockroachDBDialect doesn’t have it.

image.png

I tried using the Postgres adapter, but it won’t work with SSL, since it doesn’t recognize the SSL options sslmode nor sslrootcert, I tried using the Postgres connection params names but I keep getting the same error.

Has anybody used CockroachDB with Gino or Sanic (I wouldn’t mind changing the ORM) before?

My approach so far is to hack the asyncpg driver and adapt the init_pool method from there, which I would add to a custom dialect that inherits from CockroachDBDialect, but I’m open to suggestions.

Any help would be appreciated.

Thanks a lot in advance.

Cheers!