2
votes

We are currently using NodeJs with Knex for connecting with MySQL.
We have plans to migrate our database to Cloud Spanner.
So wanted to know, if knexjs has support for cloud spanner.
I did not see any related articles in their official website (http://knexjs.org/).

If not, any ORM which has support to both MySQL and Cloud Spanner which will have minimal changes from knexjs

2

2 Answers

2
votes

We continued using Knexjs for our Spanner operations. It is working fine so far. We build the queries using knex and convert it to raw queries using

querybuilder.toSQL()

and binding the parameters.

-1
votes

The Google public docs list the different libraries that can be used with Google Cloud Spanner. You can use node.js with Cloud Spanner so I believe the knexjs should also work. A recommendation is to modify your code so that knexjs outputs the SQL command to help with debugging in case certain commands don't work