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
According to the javadoc in the InsertSettings the option addDatabase allows to query another database than the one defined in the client. Which is not the case
Steps to reproduce
Create a client with any database
Create a table in another database
Create an insertSetting with the option setDatabase with the database where you created your table
Insert data
Expected behaviour
It's expected that the data would be inserted in the correct table
Code example
Clientclient = newClient.Builder()
.addEndpoint(Protocol.HTTP, "localhost", 8123, false)
.setUsername("default")
.setPassword("")
.useNewImplementation(System.getProperty("client.tests.useNewImplementation", "true").equals("true"))
.build();
finalStringtableName = "insert_settings_database_test";
finalStringnew_database = "new_database";
client.query("CREATE DATABASE " + new_database);
client.query("CREATE TABLE " + new_database + "." + tableName + " (Id UInt32, event_ts Timestamp, name String, p1 Int64, p2 String) ENGINE = MergeTree() ORDER BY ()");
InsertSettingsinsertSettings = settings.setDatabase(new_database); ByteArrayOutputStreamdata = newByteArrayOutputStream();
PrintWriterwriter = newPrintWriter(data);
for (inti = 0; i < 1000; i++) {
writer.printf("%d\t%s\t%s\t%d\t%s\n", i, "2021-01-01 00:00:00", "name" + i, i, "p2");
}
writer.flush();
InsertResponseresponse = client.insert(tableName, newByteArrayInputStream(data.toByteArray()),
ClickHouseFormat.TSV, insertSettings).get(30, TimeUnit.SECONDS);
Error log
com.clickhouse.client.api.ServerException: Code: 60. DB::Exception: Table default.insert_settings_database_test does not exist. Maybe you meant new_database.insert_settings_database_test?. (UNKNOWN_TABLE) (version 24.9.2.42 (official build))
at com.clickhouse.client.api.internal.HttpAPIClientHelper.readError(HttpAPIClientHelper.java:314)
at com.clickhouse.client.api.internal.HttpAPIClientHelper.executeRequest(HttpAPIClientHelper.java:357)
at com.clickhouse.client.api.Client.lambda$insert$7(Client.java:1331)
at com.clickhouse.client.api.Client.runAsyncOperation(Client.java:1864)
at com.clickhouse.client.api.Client.insert(Client.java:1418
Configuration
Environment
Client version:
Language version:
OS:
The text was updated successfully, but these errors were encountered:
Describe the bug
According to the javadoc in the InsertSettings the option addDatabase allows to query another database than the one defined in the client. Which is not the case
Steps to reproduce
Expected behaviour
It's expected that the data would be inserted in the correct table
Code example
Error log
com.clickhouse.client.api.ServerException: Code: 60. DB::Exception: Table default.insert_settings_database_test does not exist. Maybe you meant new_database.insert_settings_database_test?. (UNKNOWN_TABLE) (version 24.9.2.42 (official build))
Configuration
Environment
The text was updated successfully, but these errors were encountered: