Adjusting the transformers for schema support #23
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.
When using a database with a schema defined in the SQLAlchemy metadata the resulting value of
foreign_key.target_fullname
would be[schema].[table_name].[column_name]
The previous implementation splitforeign_key.target_fullname
on the.
and definedleft_table
as element[0]
([schema]
) andleft_column
as element[1]
([table_name]
). This splitting does not take into account the possibility of a schema.The
table_name
values defined inself.metadata.tables
are stored as[schema].[table_name]
. Therefore, the logic to enforce the existence of the table on the left side was alwaysFalse
when a schema is present because the names was not the same.Changing the assumption to be that the last element
[-1]
of the resulting array when splittingforeign_key.target_fullname
on a.
is the column name, ensures that regardless of the use of a schema thatleft-column
will be the correct value forcolumn_name
. Additionally, since the value of the table name stored inself.metadata.tables
isforeign_key.target_fullname
less.[column_name]
, by rejoining the elements of the split less the last element[:-1]
by a.
results in the correct value forleft_table
regardless of schema usage.