sql, stream - provide schema_identifier to avoid errors

This commit is contained in:
Andrej730
2025-09-04 18:53:27 +05:00
parent b6fa1759ef
commit 274a5cbfad
2 changed files with 20 additions and 6 deletions
+10 -3
View File
@@ -37,8 +37,6 @@ except ImportError as e:
class sqlite(file):
schema: ifcopenshell.util.schema.IFC_SCHEMA = "IFC4"
def __init__(self, filepath: str):
"""
Open existing sqlite IFC database.
@@ -81,7 +79,7 @@ class sqlite(file):
except:
assert False, "SQLite schema not supported."
self.schema = row[1]
self._schema = row[1]
self.ifc_schema = ifcopenshell.schema_by_name(self.schema)
self.cursor.execute("SELECT ifc_id, ifc_class FROM id_map")
@@ -272,6 +270,15 @@ class sqlite(file):
# Override to avoid clean up data unrelated to sqlite file.
pass
@property
def schema(self) -> ifcopenshell.util.schema.IFC_SCHEMA:
return self._schema
@property
def schema_identifier(self) -> str:
# The best option we've got for mimicing `file.schema_identifier`.
return self._schema
class sqlite_entity(entity_instance):
sqlite_wrapper: sqlite_wrapper
+10 -3
View File
@@ -87,8 +87,6 @@ try:
return (int(items[0]), str(items[1]), items[2])
class stream(file):
schema: ifcopenshell.util.schema.IFC_SCHEMA = "IFC4"
def __init__(self, filepath: str):
self.wrapped_data = None
self.history_size = 64
@@ -176,7 +174,7 @@ try:
self.class_map.setdefault(ifc_class, []).append(step_id)
self.id_offset[step_id] = offset
elif line.startswith("FILE_SCHEMA"):
self.schema = line.split("'")[1]
self._schema = line.split("'")[1]
self.ifc_schema = ifcopenshell.schema_by_name(self.schema)
for ifc_class in exclude_classes:
declaration = self.ifc_schema.declaration_by_name(ifc_class)
@@ -290,6 +288,15 @@ try:
# Override to avoid clean up unrelated to stream file.
pass
@property
def schema(self) -> ifcopenshell.util.schema.IFC_SCHEMA:
return self._schema
@property
def schema_identifier(self) -> str:
# The best option we've got for mimicing `file.schema_identifier`.
return self._schema
class stream_entity(entity_instance):
stream_wrapper: stream_wrapper