Skip to content

Commit

Permalink
refactor: use Python 3.9 new dict merge operator
Browse files Browse the repository at this point in the history
  • Loading branch information
reata committed Feb 15, 2025
1 parent 10b7445 commit 24468c3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def run(self) -> None:
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
],
python_requires=">=3.8",
python_requires=">=3.9",
install_requires=[
"sqlparse==0.5.3",
"networkx>=2.4",
Expand Down
23 changes: 11 additions & 12 deletions sqllineage/core/holders.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,18 @@ def get_alias_mapping_from_table_group(
A table can be referred to as alias, table name, or database_name.table_name, create the mapping here.
For SubQuery, it's only alias then.
"""
return {
**{
tgt: src
for src, tgt, attr in self.graph.edges(data=True)
if attr.get("type") == EdgeType.HAS_ALIAS and src in table_group
},
**{
table.raw_name: table
for table in table_group
if isinstance(table, Table)
},
**{str(table): table for table in table_group if isinstance(table, Table)},
alias_map = {
tgt: src
for src, tgt, attr in self.graph.edges(data=True)
if attr.get("type") == EdgeType.HAS_ALIAS and src in table_group
}
unqualified_map = {
table.raw_name: table for table in table_group if isinstance(table, Table)
}
qualified_map = {
str(table): table for table in table_group if isinstance(table, Table)
}
return alias_map | unqualified_map | qualified_map

def _get_target_table(self) -> Optional[Union[SubQuery, Table]]:
table = None
Expand Down

0 comments on commit 24468c3

Please sign in to comment.