You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to change the configured database after the client has been created. For our tests, we use a client to create a variety of databases for integration tests. Ideally, we would only have a single connected client for these interactions rather than creating multiple clients (given the way our code is written).
Steps to reproduce
Create a Clickhouse client instance
const client = createClient(options)
Since there aren't any public setters/getters to change the database, you have to modify the client's private parameters with
client.config.database = newDbName;
Desired feature
client.setDatabase(newDbName);
The text was updated successfully, but these errors were encountered:
Since it's mostly for testing purposes, could the following work for you?
// somewhere in the setupconsttestDatabase= ...
awaitclient.exec({query: `CREATE DATABASE ${testDatabase}`})// in the test suiteawaitclient.query({query: `SELECT * FROM ${testDatabase}.${table}`,format: 'JSONEachRow'})
i.e. explicitly write the database in the queries.
Describe the feature request
I want to change the configured database after the client has been created. For our tests, we use a client to create a variety of databases for integration tests. Ideally, we would only have a single connected client for these interactions rather than creating multiple clients (given the way our code is written).
Steps to reproduce
const client = createClient(options)
client.config.database = newDbName;
Desired feature
The text was updated successfully, but these errors were encountered: