Skip to main content

A package that integrates pandas and sqlalchemy.

Project description

pandalchemy: an intuitive combination of Pandas and sqlalchemy to manipulate sql databases with pandas

What is it?

pandalchemy is a Python package that lets Data Scientists create and manipulte sql databases with the Pandas package that they know and love without needing to learn the ins and outs of sqlalchemy.

Main Features

Here are just a few of the things that pandalchemy does:

  • Pulls down any sql table as a Pandas DataFrame with sqlalchemy and maintains all data types, keys, and indexes after you push your changes.
  • Make changes to Pandas DataFrame as you normally would then push any changes (new columns, delete columns, new rows, updated rows) to sql database.
  • Adds a primary key to a new sql table, something pandas to_sql method does not do.
  • Add or delete columns in a database table thanks to sqlalchemy-migrate.

Where to get it

The source code is currently hosted on GitHub at: https://github.com/eddiethedean/pandalchemy

# PyPI
pip install pandalchemy

Dependencies

Example code

from sqlalchemy import create_engine 
import pandalchemy as ba 

# Use sqlalchemy to create an engine to connect to existing database 
engine = create_engine('postgresql://scott:tiger@localhost:5432/mydatabase') 

# Initialize a pandalchemy DataBase object 
db = ba.DataBase(engine) 

# Accessing a table by name gives you a DataFrame like Table object 
tbl = db['test_table'] 

# Make changes to the Table just like you would a pandas DataFrame 
tbl['age'] = [11, 12, 13, 14, 15] 

# Use the push method to push all your changes to your database 
db.push() 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pandalchemy-0.1.6-py2.py3-none-any.whl (16.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pandalchemy-0.1.6-py2.py3-none-any.whl.

File metadata

  • Download URL: pandalchemy-0.1.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for pandalchemy-0.1.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ac78682f6412789745210da6653ff9810f13cc9e94bcdacae2957d22c5622b29
MD5 4a0f968f1de2a3744f9c8b508ee4c092
BLAKE2b-256 60e482cd0136fb864dc9bd101f5493e80a18af5ac85392121f02a485771ff156

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page