Skip to content

fanqingsong/sqlalchemy_tables_copier

Repository files navigation

SQLAlchemy Tables Copier

image

image

Documentation Status

Copy tables and their data from one db to another db.

Usages

import logging

from app.db.session import SessionLocal
from app.db.session import engine

from app.db.session import SessionLocal_dest
from app.db.session import engine_dest

from 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.

About

Based on sqlalchemy metadata, generate tables' schema in another db, and copy data from those tables.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published