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?
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:
conSQLAlchemy 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
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.