how to change the active database #9968
-
I am using this code to read delta table from fabric onelake and expose it as an ibis connection
my problem is, I don't know how to tell ibis to create those tables in the database db, currently it goes to main by default ? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments
-
What is |
Beta Was this translation helpful? Give feedback.
-
in onelake, we have three naming convention, catalog, database then table |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
When you use any The view is going to be created in the database >>> import ibis
>>> con = ibis.duckdb.connect()
>>> con.list_databases()
['information_schema', 'main', 'pg_catalog']
>>> con.create_database("new")
>>> con.list_databases()
['information_schema', 'main', 'new', 'pg_catalog']
>>> # load data from wherever, which creates a view in `main`
>>> t = con.read_parquet("ci/ibis-testing-data/parquet/awards_players.parquet")
>>> # now persist that data to a table in a different `database`
>>> con.create_table("awards", t, database="new")
DatabaseTable: memory.new.awards
playerID string
awardID string
yearID int64
lgID string
tie string
notes string
>>> con.list_tables(database="new")
['awards'] |
Beta Was this translation helpful? Give feedback.
-
I see, thanks, but i don't want to persist the data, I want to keep it as a view |
Beta Was this translation helpful? Give feedback.
-
You can use
it'll still show in |
Beta Was this translation helpful? Give feedback.
-
thanks, that works !!! |
Beta Was this translation helpful? Give feedback.
You can use
it'll still show in
con.list_tables(database="new")
because at the moment it list everything, tables and views. There is a PR in the works to separate the listing of views vs tables though.