Fix luigi.contrib.sqla performance bug; don't reflect all tables #2104
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The sqla module can be extremely slow loading if your db has a lot of tables. This is due to unnecessary reflection of all the tables.
There was a similar bug in pandas: pandas-dev/pandas#8147
Motivation and Context
Reflection is very slow when you have lots of tables. In my case the sqla module would sit for > 30 seconds when running the line
We don't need to reflect all the tables here. Instead we can only reflect and bind the table we are interested in
Have you tested this? If so, how?
Reflection is tested in sqla_test.py and with these changes my performance issue is fixed