https://github.com/fanqingsong/sqlalchemy_tables_copier
Based on sqlalchemy metadata, generate tables' schema in another db, and copy data from those tables.
https://github.com/fanqingsong/sqlalchemy_tables_copier
Last synced: 3 months ago
JSON representation
Based on sqlalchemy metadata, generate tables' schema in another db, and copy data from those tables.
- Host: GitHub
- URL: https://github.com/fanqingsong/sqlalchemy_tables_copier
- Owner: fanqingsong
- License: mit
- Created: 2023-02-25T08:43:23.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-02-26T15:21:31.000Z (over 2 years ago)
- Last Synced: 2025-01-14T13:36:27.942Z (5 months ago)
- Language: Python
- Size: 36.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
- Authors: AUTHORS.rst
Awesome Lists containing this project
README
========================
SQLAlchemy Tables Copier
========================.. image:: https://img.shields.io/pypi/v/sqlalchemy_tables_copier.svg
:target: https://pypi.python.org/pypi/sqlalchemy_tables_copier.. image:: https://img.shields.io/travis/fanqingsong/sqlalchemy_tables_copier.svg
:target: https://travis-ci.com/fanqingsong/sqlalchemy_tables_copier.. image:: https://readthedocs.org/projects/sqlalchemy-tables-copier/badge/?version=latest
:target: https://sqlalchemy-tables-copier.readthedocs.io/en/latest/?version=latest
:alt: Documentation StatusCopy tables and their data from one db to another db.
* Free software: MIT license
* Documentation: https://sqlalchemy-tables-copier.readthedocs.io.Usages
--------.. code-block:: python
:emphasize-lines: 3,5
:linenos:import logging
from app.db.session import SessionLocal
from app.db.session import enginefrom app.db.session import SessionLocal_dest
from app.db.session import engine_destfrom sqlalchemy_tables_copier import TablesCopier
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)def main() -> None:
logger.info("Before copy data")tc = TablesCopier(engine, SessionLocal(), engine_dest, SessionLocal_dest())
tc.run()logger.info("After copy data")
if __name__ == "__main__":
main()Features
--------* TODO
Credits
-------This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage