SQL servers and pandas compatability

Hello, so I am new to connecting Python/Pandas to SQL servers and just wondering which of the Streamlit-compatable data sources listed can be queried and then turned into a Pandas dataframe?

For example for Big Query, there is specifically the pandas.read_gbq function - how does it work with the others? Or are some not able to be turned into pandas data frames?

Thanks

There are no “streamlit compatible” databases. These are only examples of how to use the respective databases and their client libraries together with streamlit.

You need a client library for the respective database.
pandas itself already supports a few databases directly.
This is convenient, but pandas is not mandatory for this either.

Whether a client library returns a pandas dataframe is also secondary.
In general you can turn all structured data (lists, dicts, json…) from a database query into a pandas dataframe.

Thanks for this but just want to check, can I use pandas.read_sql() for all the databases listed? Wouldn’t you need to make sure the database has the correct connection as it says in the documentation that pandas.read_sql() must have the ‘con’ argument and 1 of 3 connections:

con SQLAlchemy connectable, str, or sqlite3 connection

Using SQLAlchemy makes it possible to use any DB supported by that library. If a DBAPI2 object, only sqlite3 is supported. The user is responsible for engine disposal and connection closure for the SQLAlchemy connectable; str connections are closed automatically. Seehere.

Apologies if this is basic - haven’t connected Python to SQL servers before

Probably not, but why would you care? You are not going to conect to all of them at the same time, are you?

Yes.

In case you didn’t notice, most of the data sources in the list are not SQL databases.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.