Skip to content

Commit

Permalink
Ensure discoverability of orphaned enumeration objects
Browse files Browse the repository at this point in the history
  • Loading branch information
hunyadi committed Jan 31, 2024
1 parent ca0ae5a commit dcb707e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 1 addition & 3 deletions pysqlsync/dialect/oracle/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,6 @@ async def _get_namespace(self, namespace_id: Optional[LocalId] = None) -> Namesp
tables.append(table)

if tables:
return self.factory.namespace_class(
LocalId(""), enums=[], structs=[], tables=tables
)
return self.factory.namespace_class(enums=[], structs=[], tables=tables)
else:
return self.factory.namespace_class()
2 changes: 1 addition & 1 deletion pysqlsync/dialect/postgresql/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ async def get_namespace(self, namespace_id: LocalId) -> Namespace:
table = await self.get_table(QualifiedId(namespace_id.id, table_name))
tables.append(table)

if tables:
if enums or structs or tables:
return self.factory.namespace_class(
namespace_id, enums=enums, structs=structs, tables=tables
)
Expand Down
10 changes: 10 additions & 0 deletions pysqlsync/formation/object_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,16 @@ def __init__(self) -> None:
def __init__(self, name: LocalId) -> None:
...

@overload
def __init__(
self,
*,
enums: list[EnumType],
structs: list[StructType],
tables: list[Table],
) -> None:
...

@overload
def __init__(
self,
Expand Down

0 comments on commit dcb707e

Please sign in to comment.