Convert any SQL Database to a Pandas DataFrame
$ pip install a-pandas-ex-read-sql
from a_pandas_ex_read_sql import pd_add_read_sql_file
pd_add_read_sql_file()
import pandas as pd
dict_with_dfs = pd.Q_read_sql(r"F:\msgstorexxxxxxxxxxxxxxxxx.db")
Update 13.5:
# Added .SQL File Reading Functionality
# To read an .SQL file and obtain the data, you can use the pd.Q_read_sql() function.
# This code reads the specified SQL file (.sql - only INSERT commands) and returns a DataFrame containing the data from the file.
df = pd.Q_read_sql(r"C:\Users\hansc\Downloads\sax\world.sql")
# Reading an SQLite Database File (.db)
# To read an SQLite database file and retrieve the data, you can also use the pd.Q_read_sql() function.
# This code reads the specified SQLite database file (northwind.db) and returns a DataFrame containing the data in a dict of DataFrames.
df2 = pd.Q_read_sql(r"C:\Users\hansc\Downloads\northwind.db")
# To convert all tables in an SQLite database file into a single DataFrame, you can use the pd.Q_db_to_one_df() # function. This code reads the specified SQLite database file (northwind.db), retrieves all the tables, and combines them into a single DataFrame.
df3 = pd.Q_db_to_one_df(path=r"C:\Users\hansc\Downloads\northwind.db")
# Splitting a DataFrame into Grouped DataFrames (Revert the last step)
# To split a DataFrame into multiple DataFrames based on specified columns, you can use the d_split_in_groups() # function. This code splits the DataFrame (df3) into multiple DataFrames based on the "aa_table" column. The result is a dictionary where the keys are group names, and the values are the corresponding split DataFrames.
df4 = df3.d_split_in_groups(columns=["aa_table"])
# To revert the grouped DataFrames back into a single DataFrame (without reading SQL), you can use the pd.Q_groupdict_to_one_df() function.
# This code takes the dictionary of grouped DataFrames (df4) and combines them into a single DataFrame.
df5 = pd.Q_groupdict_to_one_df(df4)
Metadata
Release files for a-pandas-ex-read-sql 0.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| a_pandas_ex_read_sql-0.11.tar.gz | 6.4 kB | Without provenance | Details for a_pandas_ex_read_sql-0.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| a_pandas_ex_read_sql-0.11-py3-none-any.whl | Python 3 | none | any | Details for a_pandas_ex_read_sql-0.11-py3-none-any.whl |
Total release size: 14.6 kB
Release files / a_pandas_ex_read_sql-0.11.tar.gz
| Download URL | a_pandas_ex_read_sql-0.11.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
233f2e0a7df947135cd4a1e01e0f62034cf3246ae4d646910915a31de27fa58e
|
|
BLAKE2b-256 checksum How to use checksums |
20e51184505e7a714b3642e5fe0783afeef0f6f1868fe6b79e7a59e25457b636
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Release files / a_pandas_ex_read_sql-0.11-py3-none-any.whl
| Download URL | a_pandas_ex_read_sql-0.11-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3988d4f68fa13258fecb2d0cac3834f2e6cb12838074a27a399ea698520bbeb0
|
|
BLAKE2b-256 checksum How to use checksums |
78e23eaf709934feec31188f73bb684648f31314569e2376fd351fd62d0a83b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Security for a-pandas-ex-read-sql 0.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.