Pragmas
PRAGMA help
Print out list of pragma supported by ECSQL.
| pragma | type | descr |
|---|---|---|
| checksum | global | checksum([ecdb_schema|ecdb_map|sqlite_schema]) return sha3 checksum for data. |
| ecdb_ver | global | return current and file profile versions |
| experimental_features_enabled | global | enable/disable experimental features |
| validate_ecsql_writes | global | enable/disable validation for values in an ecsql statement |
| explain_query | global | explain query plan |
| help | global | return list of pragma supported |
| integrity_check | global | performs integrity checks on ECDb |
| parse_tree | global | parse_tree(ecsql) return parse tree of ecsql. |
| disqualify_type_index | class | set/get disqualify_type_index flag for a given ECClass |
PRAGMA checksum
Calculate and print out SHA3 256 hash for a subset of the ec_ tables or the sqlite schema
- ecdb_schema - Includes only the ec definition tables but not the mapping tables
ec_Schema,ec_SchemaReference,ec_Class,ec_ClassHasBaseClasses,ec_Enumeration,ec_KindOfQuantity,ec_UnitSystem,ec_Phenomenon,ec_Unit,ec_Format,ec_FormatCompositeUnit,ec_PropertyCategory,ec_Property,ec_RelationshipConstraint,ec_RelationshipConstraintClass,ec_CustomAttribute - ecdb_map - Includes only the ec mapping tables but not the ec definition tables
ec_PropertyPath,ec_ClassMap,ec_Table,ec_Column,ec_Index,ec_IndexColumn,ec_PropertyMap - sqlite_schema - Includes information in the
sqlite_mastertable
PRAGMA ecdb_ver
Print out ECDb current profile version supported by software and file profile version.
| current | file |
|---|---|
| 4.0.0.4 | 4.0.0.2 |
PRAGMA experimental_features_enabled
Enable experimental feature in ECSQL on current connection.
to switch off
to check if flag is currently set.
| experimental_features_enabled |
|---|
| False |
PRAGMA validate_ecsql_writes
Enable validation of values in ECSQL insert statement on current connection.
to switch off
to check if flag is currently set.
| validate_ecsql_writes |
|---|
| False |
PRAGMA explain_query
Prints out a high level description of the strategy or plan SQLite uses to implement a specific SQL query generated by the input ECSql query. For use in interactive debugging purposes, the output of this command may change in the future.
| id | parent | notused | detail |
|---|---|---|---|
| 3 | 0 | 215 | SCAN main.bis_GeometricElement3d |
| 5 | 0 | 45 | SEARCH main.bis_Element USING INTEGER PRIMARY KEY (rowid=?) |
PRAGMA integrity_check (experimental)
check_ec_profile- checks if the profile table, indexes, and triggers are present. Does not check be_* tables. Issues are returned as a list of tables/indexes/triggers which were not found or have different DDL.check_data_schema- checks if all the required data tables and indexes exist for mapped classes. Issues are returned as a list of tables/columns which were not found or have different DDL.check_data_columns- checks if all the required columns exist in data tables. Issues are returned as a list of those tables/columns.check_nav_class_ids- checks ifRelClassIdof a Navigation property is a valid ECClassId. It does not check the value to match the relationship class.check_nav_ids- checks ifIdof a Navigation property matches a valid row primary class.check_linktable_fk_class_ids- checks ifSourceECClassIdorTargetECClassIdof a link table matches a valid ECClassId.check_linktable_fk_ids- checks ifSourceECInstanceIdorTargetECInstanceIdof a link table matches a valid row in primary class.check_class_ids- checks persistedECClassIdin all data tables and makes sure they are valid.check_schema_load- checks if all schemas can be loaded into memory.
The output of integrety_check is a table with each test performed, the result and time took to run the test.
| sno | check | result | elapsed_sec |
|---|---|---|---|
| 1 | check_data_columns | True | 0.005 |
| 2 | check_ec_profile | True | 0.001 |
| 3 | check_nav_class_ids | True | 0.179 |
| 4 | check_nav_ids | True | 0.403 |
| 5 | check_linktable_fk_class_ids | True | 0.001 |
| 6 | check_linktable_fk_ids | False | 0.003 |
| 7 | check_class_ids | True | 0.039 |
| 8 | check_data_schema | True | 0.000 |
| 9 | check_schema_load | True | 0.000 |
PRAGMA parse_tree (experimental)
Generates a json representation parsed tree of the input ECSql.
Last Updated: 08 August, 2025