ifcpatch.recipes.Ifc2Sql
¶
Module Contents¶
- class ifcpatch.recipes.Ifc2Sql.Patcher(file, logger, sql_type: SQLTypes = 'SQLite', host: str = 'localhost', username: str = 'root', password: str = 'pass', database: str = f'{DEFAULT_DATABASE_NAME}.sqlite', full_schema: bool = True, is_strict: bool = False, should_expand: bool = False, should_get_inverses: bool = True, should_get_psets: bool = True, should_get_geometry: bool = True, should_skip_geometry_data: bool = False)¶
Convert an IFC-SPF model to SQLite or MySQL.
- Parameters:
sql_type – Choose between “SQLite” or “MySQL”
database – Database path to save the SQL database to (already existing or not). Could also be a directory, then the database will be stored using default filename (e.g. ‘database.sqlite’).
full_schema – if True, will create tables for all IFC classes, regardless if they are used or not in the dataset. If False, will only create tables for classes in the dataset.
is_strict – whether or not to enforce null or not null. If your dataset might contain invalid data, set this to False.
should_expand – if True, entities with attributes containing lists of entities will be separated into multiple rows. This means the ifc_id is no longer a unique primary key. If False, lists will be stored as JSON.
should_get_psets – if True, a separate psets table will be created to make it easy to query properties. This is in addition to regular IFC tables like IfcPropertySet.
should_get_geometry – Whether or not to process and store explicit geometry data as a blob in a separate geometry and shape table.
should_skip_geometry_data – Whether or not to also create tables for IfcRepresentation and IfcRepresentationItem classes. These tables are unnecessary if you are not interested in geometry.
- Filter_glob database:
.db;.sqlite
Example:
# Convert to SQLite, SQLite databse will be saved to a temporary file. sqlite_temp_filepath = ifcpatch.execute( {"input": "input.ifc", "file": model, "recipe": "Ifc2Sql", "arguments": ["sqlite"]} )
- create_geometry() None ¶
- create_geometry_table() None ¶
- create_id_map() None ¶
- create_metadata() None ¶
- create_mysql_table(ifc_class: str, declaration: ifcopenshell.ifcopenshell_wrapper.declaration) None ¶
- create_pset_table() None ¶
- create_sqlite_table(ifc_class: str, declaration: ifcopenshell.ifcopenshell_wrapper.declaration) None ¶
- get_permutations(lst: list[Any], indexes: list[int]) list[Any] ¶
- insert_data(ifc_class: str) None ¶
- is_entity_list(attribute: ifcopenshell.ifcopenshell_wrapper.attribute) bool ¶
- patch() None ¶
- serialise_value(element: ifcopenshell.entity_instance, value: Any) Any ¶
- database = 'database.sqlite'¶
- file¶
- full_schema = True¶
- host = 'localhost'¶
- is_strict = False¶
- logger¶
- password = 'pass'¶
- should_expand = False¶
- should_get_geometry = True¶
- should_get_inverses = True¶
- should_get_psets = True¶
- should_skip_geometry_data = False¶
- sql_type: Literal['sqlite', 'mysql'] = ''¶
- username = 'root'¶
- ifcpatch.recipes.Ifc2Sql.DEFAULT_DATABASE_NAME = 'database'¶
- ifcpatch.recipes.Ifc2Sql.SQLTypes¶
- ifcpatch.recipes.Ifc2Sql.SQLTypes¶