jupyterlab-sql icon indicating copy to clipboard operation
jupyterlab-sql copied to clipboard

Database schemas

Open Econ808 opened this issue 5 years ago • 3 comments

As of now, it seems there is no way to view tables unless they are under the default schema, e.g. dbo.table

It would be useful to either as a default show all schemas and the underlying tables, or at least somehow allow the user to select the schema (something that is not possible in the connection string). I guess an implementation should be possible, as the extension builds upon sqlalchemy, where schema can easily be selected when listing table names - engine.table_names(schema=foo).

Best regards

Econ808 avatar Aug 06 '19 12:08 Econ808

Thanks for raising this. What flavour of SQL / database engine are you referring to?

pbugnion avatar Aug 11 '19 12:08 pbugnion

Microsoft SQL, using mssql+pyodbc to connect with sqlalchemy:

I don't have much experience in programming extensions, but looking at the code, I believe a function in the Class Executer could return the schemas:

def fetch_schema_names(self, connection_url):
    engine = self._get_engine(connection_url)
    insp = inspect(engine)
    return insp.get_schema_names()

The entire thing about programming the interface and handlers is too big of a mouthful for me at this stage though...

Econ808 avatar Aug 11 '19 13:08 Econ808

I use postgre and do not using scheme "public" generally. It would be greate view all schemas and tables from data base which I connected.

VolokzhaninVadim avatar Dec 23 '19 12:12 VolokzhaninVadim