Home | Table of Contents | Dynamic Metadata | CloverETL 4.6.1
--- | --- | ---
Prev | Metadata Types | Next

### Dynamic Metadata

Dynamic metadata is metadata extracted from result of SQL query.

Remember that dynamic metadata are generated dynamically at runtime only. As a result, its fields cannot be viewed or modified in metadata editor in CloverETL Designer.

To define the dynamic metadata open the Source tab and write there the following:

    <Metadata id="YourMetadataId"
              connection="YourConnectionToDB"
              name="YourMetadataName"
              sqlQuery="YourQuery"/>

You can add attribute `sqlOptimization="true"` to speed up metadata extraction process.

Specify a unique expression for `YourMetadataId` (e.g. DynamicMetadata1) and an id of a previously created DB connection that should be used to connect to DB as `YourConnectionToDB`. Type the query that will be used to extract meta data from DB as `YourQuery` (e.g. select * from myTable).

Example 32.3.

    <Metadata connection="JDBC0" id="DynamicMetadata0" name="users"
              sqlQuery="SELECT * FROM users LIMIT 1"/>

In order to speed up the metadata extraction, add the clause `"where 1=0"` or `"and 1=0"` to the query. The former one should be added to a query with no where condition and the latter clause should be added to the query which already contains `"where ..."` expression. This way only metadata are extracted and no data will be read.

| Note
It is highly recommended you skip the `checkConfig` method whenever dynamic metadata is used. To do that, tick Skip checkConfig checkbox in Run Configuration dialog. See Run Configuration.

Prev | Up | Next
External (Shared) Metadata | Home | Table of Contents | Reading Metadata from Special Sources