diff --git a/pysqlsync/dialect/oracle/discovery.py b/pysqlsync/dialect/oracle/discovery.py index 40d9972..3a7b8a4 100644 --- a/pysqlsync/dialect/oracle/discovery.py +++ b/pysqlsync/dialect/oracle/discovery.py @@ -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() diff --git a/pysqlsync/dialect/postgresql/discovery.py b/pysqlsync/dialect/postgresql/discovery.py index 0012dbf..912fc63 100644 --- a/pysqlsync/dialect/postgresql/discovery.py +++ b/pysqlsync/dialect/postgresql/discovery.py @@ -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 ) diff --git a/pysqlsync/formation/object_types.py b/pysqlsync/formation/object_types.py index 3469596..3753161 100644 --- a/pysqlsync/formation/object_types.py +++ b/pysqlsync/formation/object_types.py @@ -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,