Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster method for migrating data in batches #20

Open
tompollard opened this issue Jan 3, 2019 · 0 comments
Open

Faster method for migrating data in batches #20

tompollard opened this issue Jan 3, 2019 · 0 comments

Comments

@tompollard
Copy link
Member

The current approach (_copy_data) for loading data from the source database relies on limit + offset, which is slow. Replace it with a faster approach, perhaps using yield_per or a window function. e.g.:

        for data in source_session.query(table).yield_per(batchsize):
            _insert_data(target_session,source_schema,table,data)

See:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant