Closed xunziheng closed 1 year ago
Hi @xunziheng! There is no such possibility atm. You can use "USE" statement after you open a session:
const dbName = `your_dbname`;
const client = await new hive.HiveClient(
TCLIService,
TCLIService_types
).connect(
{
host: 'localhost',
port: 10000
},
new hive.connections.TcpConnection(),
new hive.auth.NoSaslAuthentication()
);
const session = await client.openSession({
client_protocol: TCLIService_types.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V10
});
await session.executeStatement(`USE ${dbName}`);
The issue with setting db within the connection is that open session request is not documented well: https://github.com/lenchv/hive-driver/blob/master/thrift/TCLIService.thrift#L583
There is a configuration hash map, that overlaps Hive default configurations, so probably there is some config to do this, but the easiest is to use "USE" statement
Hi @lenchv ! Great to receive your reply, I got it, it's a good library that I already use in production and hope we can improve it better together.
for example: