-
Notifications
You must be signed in to change notification settings - Fork 662
Description
What happened?
I ran into this as a side issue when debugging an error related to #10519. The documentation for the get_name
method indicates that it should return the fully qualified name of the table. In some instances, this does not appear to be true. Here's a reproducible example using the duckdb backend that loads a parquet file into a table named test_table
. This actually creates a temporary view with a fully qualified name temp.main.test_table
(although the documentation could be clearer about this). I then create another table called test_table
using the create_table
method. This does not overwrite the initial table, but creates a second table with fully qualified name test.main.test_table
.
I initially used this pattern with the understanding that the create_table
method would replace the table created by the read_parquet
method, but this does not appear to be the case. Repeated calls to con.table("test_table")
actually returns the temporary view. get_name
is not very helpful with debugging, because it does not return the fully qualified table name unless the database
argument is explicitly provided.
import ibis
import pandas as pd
df = pd.DataFrame({
"id": [1, 2, 3],
"name": ["Alice", "Bob", "Charlie"],
"age": [25, 30, 35],
})
df.to_parquet("test.parquet")
con = ibis.connect("duckdb://test.db")
# Load parquet file into a table named `test_table`
test_table = con.read_parquet("test.parquet", table_name = "test_table")
test_table.get_name()
# Create a new table named `test_table`
test_table = con.create_table(
"test_table",
test_table.mutate(new_var = ibis.literal("test")),
overwrite = True
)
con.list_tables(database = "temp.main")
con.list_tables(database = "test.main")
print("`get_name` output")
print(con.table("test_table", database = "temp.main").get_name())
print(con.table("test_table", database = "test.main").get_name())
print(con.table("test_table").get_name())
print(test_table.get_name())
print("`execute` output")
print(con.table("test_table", database = "temp.main").execute())
print(con.table("test_table", database = "test.main").execute())
print(con.table("test_table").execute())
print(test_table.execute())
# Output
`get_name` output
temp.main.test_table
test.main.test_table
test_table
test.main.test_table
`execute` output
id name age
0 1 Alice 25
1 2 Bob 30
2 3 Charlie 35
id name age new_var
0 1 Alice 25 test
1 2 Bob 30 test
2 3 Charlie 35 test
id name age
0 1 Alice 25
1 2 Bob 30
2 3 Charlie 35
id name age new_var
0 1 Alice 25 test
1 2 Bob 30 test
2 3 Charlie 35 test
What version of ibis are you using?
10.6.0
What backend(s) are you using, if any?
DuckDB
Relevant log output
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
Type
Projects
Status