Connecting To multiple Database in snowflake

Is it possible to connect to multiple Databases inside snowflake, so that i can list all the tables inside those DB’s

Hi @Ishwarya_Rajan :slightly_smiling_face:

Yes, it’s possible. Please use the dataSource option. Here are relevant docs pages:

1 Like


I am getting the following error
Cannot perform SELECT. This session does not have a current database. Call ‘USE DATABASE’, or use a qualified name.

What would be the reason ?

Сould you please share the cube.js file and the data schema?

Do you try configure your cube.js file like in example at docs?

module.exports = {
  driverFactory: ({ dataSource } = {}) => {
    if (dataSource === 'db1') {
      return new PostgresDriver({
        database: DB1_NAME,
        host: DB1_HOST,
        user: DB1_USER,
        password: DB1_PASS,
        port: DB1_PORT,
    } else {
      return new PostgresDriver({
        database: DB2_NAME,
        host: DB2_HOST,
        user: DB2_USER,
        password: DB2_PASS,
        port: DB2_PORT,

@antonrychkov this is the cube.js file

var snowflake = require(’@cubejs-backend/snowflake-driver’);
module.exports = {
driverFactory: ({ dataSource } = {}) => {
if (dataSource === ‘snowflake’) {
return new snowflake({
database: ‘’,
user: ‘’,