pbugnion / jupyterlab-sql

SQL GUI for JupyterLab
MIT License
415 stars 52 forks source link

Database schemas #95

Open Econ808 opened 5 years ago

Econ808 commented 5 years ago

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

pbugnion commented 5 years ago

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

Econ808 commented 5 years ago

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...

VolokzhaninVadim commented 4 years ago

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.