ibis
ibis copied to clipboard
feat: API to interact with databases
The current API to interact with databases is a bit cumbersome in my opinion. I think we should simplify it.
To set a database at connection, list databases, and use the default database, things are simple, no comments here: To list the available databases, set a
con = ibis.my_backend.connect(..., database='default_db')
con.list_databases()
my_table = con.table('my_table')
But then, things become not very clear IMHO. If I want to get a table from a different database, there are different ways that a user could expect they work, based on what we have:
con.table('other_db_table', database='other')
con.database('other').table('other_db_table')
con.set_database('other')
con.table('other_db_table')
con.current_database = 'other'
con.table('other_db_table')
I don't think we're making a favor to the users by providing so many options, but the opposite. To me what makes sense is to have a single way to change the default database con.current_database = 'other' (whatever name with think it's the best, database, current_database, default_database, db... no strong preference). And to have a single way to create a table, con.table(name, database=default_database). I think everything else should be removed from the public API.
Would be good to know from users who use multiple databases, if this makes sense.