This library makes your software to dump and load data in databases with sqlalchemy.
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
sqlalchemy-loadump
✨Features
- Dump data in databases to file
- Load data from file into databases
- Dump/Load without defining SQLAlchemy table
📥Installation
Latest version
pip install sqlalchemy-loadump
Specific version(e.g. 0.1.1)
pip install sqlalchemy-loadump==0.1.1
📖Usage
⌨️Commandline
Dump
This command dumps data in the sqlite3 database (db.sqlite3) to the json file.
python -m sqlalchemy_loadump dump \
--dump-file-type=json \
--dump-file-path=dump.json \
--db-url=sqlite:///db.sqlite3
Load
This command loads data from the json file and inserts it into the sqlite3 database (db.sqlite3) database.
python -m sqlalchemy_loadump load \
--dump-file-type=json \
--dump-file-path=dump.json \
--db-url=sqlite:///db.sqlite3
📦Dependencies
- Python 3.8+
- SQLAlchemy 2.0+
📦Development dependencies
- Poetry
- Docker
- Docker Compose
🛠️Supported Dump Formats
- JSON
🛠️Supported Databases
- SQLite3
- PostgreSQL
- Microsoft SQLServer
🛠️Supported(Tested) DataType List
SQLite3
DataType List
- BigInteger
- Boolean
- Date
- DateTime
- Double
- Enum
- Float
- Integer
- (Interval) ・・・ Treated as DateTime
- LargeBinary
- Numeric
- SmallInteger
- String
- Text
- Time
- Unicode
- UnicodeText
- Uuid
PostgreSQL
DataType List
- BigInteger
- Boolean
- Date
- DateTime
- Double
- Enum
- Float
- Integer
- Interval
- LargeBinary
- Numeric
- SmallInteger
- String
- Text
- Time
- Unicode
- UnicodeText
- Uuid
Microsoft SQLServer
DataType List
- BigInteger
- Boolean
- Date
- DateTime
- Double
- Enum
- Float
- Integer
- (Interval) ・・・ Treated as DateTime
- LargeBinary
- Numeric
- SmallInteger
- String
- Text
- Time
- Unicode
- UnicodeText
- Uuid
⚠️Limitation of the result of dumping.
The python type of the result of convertion depends on the column type of table reflected by MetaData.reflect.
As a result, there is a possibility of losing type information from the dumped data.
For instance, using SQLite3, when creating a table with a UUID(SQLAlchemy) column and then dumping it, the dumped result will become a string type.
However, for the types listed in the "Supported DataType List," we ensure the proper dumping and loading of data.
👨💻Development Setup
Install docker & docker-compose
This library uses docker & docker-compose to test.
You can install docker & docker-compose by following this link.
Install poetry
This library uses poetry to manage dependencies and build.
You can install poetry by following this link.
Install dependencies
Installing dependencies for this library.
poetry install
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 sqlalchemy_loadump-0.2.0.tar.gz.
File metadata
- Download URL: sqlalchemy_loadump-0.2.0.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.7.9 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cc77b88dfec32a9276ec33062798ebd33066c4b5105e5ac37491e9bf87d208d
|
|
| MD5 |
69e07c3c4edd446b7bb63efe908d9d87
|
|
| BLAKE2b-256 |
7eda4efaaf4583d1989a8d33a011e6a053f13447c4464c8a8f2f280cfe99644f
|
File details
Details for the file sqlalchemy_loadump-0.2.0-py3-none-any.whl.
File metadata
- Download URL: sqlalchemy_loadump-0.2.0-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.7.9 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad40743dca1c01830ff025cd93099795ade05162158f42c2020444950a61a355
|
|
| MD5 |
b1eb0164d5833cdbecaf491ba1ef1a30
|
|
| BLAKE2b-256 |
6f17a70c868f7a1f2be400912861c3d4c5298d46c30fdda46a78328574ab74ba
|