cleanTable
You are looking at an older version of the documentation. The latest version is found here.
This procedure empties the specified table and may be used at the beginning of connector procedures.
Parameters
| Parameter | Description |
|---|---|
tableName | Physical table to be emptied; optional |
disable | If set to TRUE, no cleanup is performed. Submit the "preview" parameter here; optional |
cleanupMethod | DELETE or DROP. Any other value will throw an error. NULL or whitespace will not perform any cleanup; optional |
If tableName is submitted as NULL or if disable is set to TRUE, this procedure will not perform any action. The most common scenario would look like this example:
CALL UTILS.cleanTable (
tableName => 'dwh.tableName',
disable => preview,
cleanupMethod => ...
);;
Currently, two cleanup methods are supported: DROP and DELETE, with DROP performing a drop of the table and DELETE performing deletion of all rows without dropping the table.
If the connector needs cleanup, we recommend defining a data source property, e.g.: modelProperties => 'cleanupMethod=DROP'.
In this case, you can use this call at the beginning of the data download procedure:
CALL UTILS.cleanTable (
tableName => 'dwh.tableName',
disable => preview,
cleanupMethod => (call connectorName.internal_getConfig(property => 'cleanupMethod'))
);;
Depending on the property's value, the corresponding cleanup method will be used. If the property is removed from the data source properties, a NULL value is passed as a procedure parameter, and no cleanup is performed. Please note that submitting any non-whitespace value to the procedure, e.g. cleanupMethod=DONTKNOW, will throw an error. The procedure also does some basic cleanup of the value (trimming spaces and uppercasing the value, though we do not recommend overusing this possibility since it is intended to be a minor typo-proof).