Make changes to sql tables using SqlAlchmey sessions
Project description
Sessionize: intutive Python SQL table manipulation toolkit
What is it?
Sessionize is a Python package that has an intuitive API that utilizes SqlAlchemy to connect to and manipulate records in SQL tables.
Main Features
Here are just a few of the things that Sessionize does well:
- Quickly and easily start a SQL session to insert, delete, and update records in SQL tables.
- Roll back any changes durring SQL session inside a context manager.
- Additional SQL migration functions for changing or adding primary keys, adding or dropping columns, renaming column and more.
Where to get it
The source code is currently hosted on GitHub at: https://github.com/eddiethedean/sessionize
# PyPI
pip install sessionize
Dependencies
- sqlalchemy - Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL
- alembic - a lightweight database migration tool for usage with the SQLAlchemy Database Toolkit for Python
Example
import sqlalchemy as sa
from sessionize import SessionTable
# Create SqlAlchemy engine to connect to database.
engine = sa.create_engine('sqlite:///foo.db')
# Create SessionTable to start session of table changes.
st = SessionTable('people', engine)
# Make changes to SessionTable:
# Add 1 to each value in the age column.
st['age'] + 1
# Update the first record with new values.
st[0] = {'id': 1, 'name': 'Olive', 'age': 18}
# Delete the last record.
del st[-1]
# Commit SessionTable to push changes to SQL table.
st.commit()
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
sessionize-0.0.18.tar.gz
(19.1 kB
view details)
Built Distribution
File details
Details for the file sessionize-0.0.18.tar.gz
.
File metadata
- Download URL: sessionize-0.0.18.tar.gz
- Upload date:
- Size: 19.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b05fcf120d0e0af96a47e0651bf9b9dfb79cf4ef9ab7277b5978bc502f72219 |
|
MD5 | 1adfe614ab03120615f0e01dc2bd1605 |
|
BLAKE2b-256 | e074e4722ea3925cdd69eba457ee3892a93f625d8c32022fd3ff28075bd605a3 |
File details
Details for the file sessionize-0.0.18-py3-none-any.whl
.
File metadata
- Download URL: sessionize-0.0.18-py3-none-any.whl
- Upload date:
- Size: 29.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 799466c6b09e6332472f6f1877aa9ee985a51aa07a42f8fec2a26a4dc5b82f8a |
|
MD5 | 134b831008daeb54f2d3c15318f4a3b6 |
|
BLAKE2b-256 | 985ab0161558c3344ebd8c056938fcaa8fe5f8784fe798840bac016d493a9cb5 |