Use this stored procedure to import models from a previously
exported .mdl file.
Authorization
Any user with the authorization
to create new analytics models can import models from an export file;
however, to overwrite a model, you need to have the authorization
to drop the existing model.
Syntax
IDAX.IMPORT_MODEL(in parameter_string varchar(32672))
Parameter descriptions
- parameter_string
- Mandatory one-string parameter that contains pairs of
<parameter>=<value> entries that are separated by a comma.
- Data type: VARCHAR(32672)
- The following list shows the parameter values:
-
- directory
- Mandatory.
- The absolute path of the directory that contains the .mdl file that you
want to import.
- The directory must already exist.
- name
- Mandatory.
- The name of the .mdl file that you want to import.
- acl
- Optional.
- Specifies whether model privileges (the access control list) are to be
imported.
- If you set the acl parameter to true but the model
privileges were not included in the export operation, a warning is returned.
- If a role specified by the imported access control list does not exist in the database, a
warning is returned.
- Default: false
- log
- Optional.
- Specifies whether a log file (with the .ilog extension) is to be written.
The log file contains a list of successfully imported models, and the name and accompanying error
message for all skipped models that were skipped by the import operation.
- Default: false
- model
- Optional.
- The schema-qualified name of the model or models that are to be imported.
- Separate multiple model names by using a semicolon. If any of the model names use mixed case,
you must enclose them by double quotation marks.
- overwrite
- Optional.
- The action that is to be taken in case of a name conflict.
- If the name of an existing model is identical to the name of the model that you are trying to
import, the import operation skips that file by default. If you specify
overwrite=true, the existing model is deleted before the new model is
imported.
- Default: false
- owner
- Optional.
- An alternative owner for all the models that are imported by the current invocation of the
IMPORT_MODEL procedure. By default, the user who performs the import operation is the owner of the
imported models.
- If you want to ensure that the original ownership of the exported models is preserved after they
are imported, specify owner=owner.
- resume
- Optional.
- Specifies whether the IMPORT_MODEL procedure is to stop when it cannot import a model.
- By default, any models that cannot be imported are skipped, and the import operation
continues.
- Default: true
- schemamap
- Optional.
- The schema transformation rules for the imported models, using a semicolon-separated list of
mappings.
- Use this parameter to replace the old schema names from the exported model file with new schema
names when those models are imported into the database. You would use this parameter in cases where
the new database does not have the same schema names as the database from which the models were
exported, or if you want to transfer some models to a different schema.
- Specify the schemamap parameter as
follows:
schemamap=mapping1;mapping2;mappingN
Mappings
are defined in the following ways:
- where
- Optional.
- A clause that filters the models that are to be imported.
- Any model that is displayed by the LIST_MODELS procedure can be filtered by the WHERE
clause.
Returned information
The IMPORT_MODEL procedure returns a result set with the schemas (original and new schema names
if there was a transformation specified by the schemamap parameter) and the
names of all successfully imported models. If the resume parameter is set to
true, the result set also includes the name and accompanying error message for all
skipped models.
Examples
- The following example imports all models from /tmp/foo.mdl. No schema transformation is performed.
call idax.import_model('directory=/tmp, name=foo')
- The following example imports all models from /tmp/foo.mdl. Models with schema
peter
are imported on schema frank
, and models with schema eva
are imported on schema alice
. All other schemas are unchanged.call idax.import_model('directory=/tmp, name=foo,
schemamap=peter:frank;eva:alice')
- The following example imports all models from /tmp/foo.mdl. Models with schema
peter
are imported on schema frank
, and all other models are imported on schema alice
. call idax.import_model('directory=/tmp, name=foo,
schemamap=peter:frank;*:alice')
- The following example imports all models from /tmp/foo.mdl. Models with schema
peter
are imported on the current schema,
and all other models are imported on schema alice
. call idax.import_model('directory=/tmp, name=foo,
schemamap=peter;*:alice')
- The following example imports all models from /tmp/foo.mdl. All models are imported on the current schema.
call idax.import_model('directory=/tmp, name=foo,
schemamap=*')