I want to have multiple DuckDBConnection instances that are having their own memory/database. What I get, however, is instances with shared access to the same memory/database.
Is this expected behavior?
using DuckDB.NET.Data;
// connection 1
Console.WriteLine("connection 1:");
var conn1 = new DuckDBConnection("DataSource=:memory:");
conn1.Open();
var cmd1 = conn1.CreateCommand();
cmd1.CommandText = "CREATE TABLE t1 (foo INTEGER, bar INTEGER);";
cmd1.ExecuteNonQuery();
cmd1.CommandText = "show tables;";
PrintQueryResults(cmd1.ExecuteReader());
// connection 2
Console.WriteLine("connection 2:");
var conn2 = new DuckDBConnection("DataSource=:memory:");
conn2.Open();
var cmd2 = conn2.CreateCommand();
cmd2.CommandText = "CREATE TABLE t2 (foo INTEGER, bar INTEGER);";
cmd2.ExecuteNonQuery();
cmd2.CommandText = "show tables;";
PrintQueryResults(cmd2.ExecuteReader());
conn1.Dispose();
conn2.Dispose();
connection 1:
name
t1
connection 2:
name
t1
t2
for comparison with the using the python API, I do get separate databases (as expected)
import duckdb
con1 = duckdb.connect(database=':memory:')
con1.execute("CREATE TABLE items1(item VARCHAR, value DECIMAL(10,2), count INTEGER)")
con2 = duckdb.connect(database=':memory:')
con2.execute("CREATE TABLE items2(item VARCHAR, value DECIMAL(10,2), count INTEGER)")
print('tables in con1: ')
con1.execute("show tables")
print(con1.fetchall())
print('tables in con2: ')
con2.execute("show tables")
print(con2.fetchall())
output:
tables in con1:
[('items1',)]
tables in con2:
[('items2',)]
I want to have multiple
DuckDBConnection
instances that are having their own memory/database. What I get, however, is instances with shared access to the same memory/database.Is this expected behavior?
for comparison with the using the python API, I do get separate databases (as expected)
output: