Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to acquire a connection #60

Open
alucryd opened this issue Mar 10, 2023 · 1 comment
Open

Unable to acquire a connection #60

alucryd opened this issue Mar 10, 2023 · 1 comment

Comments

@alucryd
Copy link

alucryd commented Mar 10, 2023

Hi there, I can't get this to work with either the connection URL nor the breakdown. It works fine using vanilla snowflake driver though, so I have no idea whether this is a bug or I'm doing something wrong. Any idea how to debug?

Connection URL and breakdown shown below:

export const snowflake = knex({
  client: SnowflakeDialect,
  debug: config.logLevel === 'debug',
  connection: `snowflake://${config.snowflakeUser}:${config.snowflakePassword}@${config.snowflakeAccount}.snowflakecomputing.com/${config.snowflakeDatabase}?warehouse=${config.snowflakeWarehouse}`,
  pool: {
    min: 1,
    max: 1,
  },
  // connection: {
  //   host: `${config.snowflakeAccount}.snowflakecomputing.com`,
  //   user: config.snowflakeUser,
  //   password: config.snowflakePassword,
  //   database: config.snowflakeDatabase,
  //   connectAttributes: {
  //     warehouse: config.snowflakeWarehouse,
  //   },
  // },
  // pool: {
  //   min: config.snowflakePoolMinConnections,
  //   max: config.snowflakePoolMaxConnections,
  // },
});

Working snippet from the snowflake documentation:

  const connection = snowflakeSdk.createConnection({
    account: config.snowflakeAccount,
    username: config.snowflakeUser,
    password: config.snowflakePassword,
    warehouse: config.snowflakeWarehouse,
    database: config.snowflakeDatabase,
    application: 'api',
  });

  connection.connect(function (err, conn) {
    if (err) {
      logger.error('Unable to connect: ' + err.message);
    } else {
      logger.info('Successfully connected to Snowflake.');
    }
  });
@NicLee0521
Copy link
Contributor

After some digging I found the reason to be a missing driverName declaration according to the knex docs just submitted a pr to get this fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants