importSchemas Method
Import ECSchema(s). On success, the schema definition is stored in the iModel. This method is asynchronous (must be awaited) because, in the case where this IModelDb is a briefcase, this method first obtains the schema lock from the iModel server. You must import a schema into an iModel before you can insert instances of the classes in that schema. See Element
importSchemas(schemaFileNames: string[], options?: SchemaImportOptions<any>): Promise<void>
@throws IModelError if the schema lock cannot be obtained or there is a problem importing the schema.
@note Changes are saved if importSchemas is successful and abandoned if not successful.
@note To turn on native logging, use NativeLoggerCategory and a console appender.
- For metadata differences between existing and imported schemas, turn on "ECDb" category.
- For import details, turn on "SchemaImport" category.
- You can use NativeLoggerCategory to turn on the native logs. You can also control what exactly is logged by the loggers.
- See Schema Versioning for more information on acceptable changes to schemas.
@note This method should not be called from {TxnManager.withIndirectTxnModeAsync} or {RebaseHandler.recompute}.
@see querySchemaVersion
| Parameter | Type | Description |
|---|---|---|
| schemaFileNames | string[] | Files containing serialized ECSchemas. |
| options | SchemaImportOptions<any> | options during schema import. |
Returns - Promise
Defined in
- backend/src/IModelDb.ts Line 1512
Last Updated: 07 May, 2026