Fix for the Pandas to_sql() dataframe method that fails when we try pushing more than 256 values.
Project description
Pandas tosql() method fix for Databricks
Fix for the Pandas to_sql() dataframe method that fails when we try pushing more than 256 values to a Databricks table.
Table of Contents
Installation
python -m pip install pandas-tosql-dbx-fix
Execution / Usage
Once the package in installed, you can use the code here to get started with the pandas-tosql-dbx-fix library in your code:
import os
import pandas_tosql_dbx_fix as pdx
# Use your own values for the following variables
server = os.getenv("DATABRICKS_SERVER_HOSTNAME", "False")
hpath = os.getenv("DATABRICKS_HTTP_PATH", "False")
catalog = os.getenv("CATALOG", "False")
schema = os.getenv("SCHEMA", "False")
token = os.getenv("DATABRICKS_TOKEN", "False")
table_name = "to_sql_table"
test_table_rows = 100
extra_connect_args = {
"user_agent_entry": "Tarek's workaround to avoid the _user_agent_entry warning message",
}
df = pdx.create_test_dataframe(test_table_rows)
# You can also connect to Databricks using a token with the pdx.connect_to_dbx_pat() function, or by creating your own SQLAlchemy engine.
db_con = pdx.connect_to_dbx_oauth(
server, hpath, catalog, schema, extra_connect_args
)
pdx.to_sql_dbx(
df,
db_con,
f"{catalog}.{schema}.{table_name}",
if_exists="append",
)
Contributing
To contribute to the development of pandas-tosql-dbx-fix, follow the steps below:
- Fork pandas-tosql-dbx-fix from https://github.com/beefupinetree/pandas-tosql-dbx-fix
- Create your feature branch (
git checkout -b feature-new) - Make your changes
- Commit your changes (
git commit -am 'Add some new feature') - Push to the branch (
git push origin feature-new) - Create a new pull request
License
pandas-tosql-dbx-fix is distributed under the MIT license. See LICENSE for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pandas_tosql_dbx_fix-1.0.0.tar.gz.
File metadata
- Download URL: pandas_tosql_dbx_fix-1.0.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69af4239ee3fd541c88cccd76b27fd1c2519e24209612502ce99f20f03922eb6
|
|
| MD5 |
3acb5ca90f4122f283e160c86b2bef4d
|
|
| BLAKE2b-256 |
3bd5f832293a3b02c0c0b9ce049e26918e3e0cf5133282f5579bd39b617c4753
|
Provenance
The following attestation bundles were made for pandas_tosql_dbx_fix-1.0.0.tar.gz:
Publisher:
python-publish.yml on beefupinetree/pandas-tosql-dbx-fix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pandas_tosql_dbx_fix-1.0.0.tar.gz -
Subject digest:
69af4239ee3fd541c88cccd76b27fd1c2519e24209612502ce99f20f03922eb6 - Sigstore transparency entry: 791315719
- Sigstore integration time:
-
Permalink:
beefupinetree/pandas-tosql-dbx-fix@d161bfd5e9be26455b93f418dd11aa9043be1313 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/beefupinetree
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@d161bfd5e9be26455b93f418dd11aa9043be1313 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pandas_tosql_dbx_fix-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pandas_tosql_dbx_fix-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee68aa42aa0fa03061d910e9ba6f7247212b29884e04794d3767bf1f314c8340
|
|
| MD5 |
db30238d0888c1b996aabafa1ace8539
|
|
| BLAKE2b-256 |
b13cb95c24f88d25d20ab0583fd37e7465ff4e33666209b58a7ed41b2b35cda0
|
Provenance
The following attestation bundles were made for pandas_tosql_dbx_fix-1.0.0-py3-none-any.whl:
Publisher:
python-publish.yml on beefupinetree/pandas-tosql-dbx-fix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pandas_tosql_dbx_fix-1.0.0-py3-none-any.whl -
Subject digest:
ee68aa42aa0fa03061d910e9ba6f7247212b29884e04794d3767bf1f314c8340 - Sigstore transparency entry: 791315722
- Sigstore integration time:
-
Permalink:
beefupinetree/pandas-tosql-dbx-fix@d161bfd5e9be26455b93f418dd11aa9043be1313 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/beefupinetree
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@d161bfd5e9be26455b93f418dd11aa9043be1313 -
Trigger Event:
release
-
Statement type: