CreateSchema
Creates a schema definition of a table in Cloudant. Control column discovery with FlattenObjects, FlattenArrays, TypeDetectionScheme, and RowScanDepth.
CreateSchema
Creates a local schema file (.rsd) from an existing table or view in the data model.
The schema file is created in the directory set in the Location connection property when this procedure is executed. You can edit the file to include or exclude columns, rename columns, or adjust column datatypes.
The driver checks the Location to determine if the names of any .rsd files match a table or view in the data model. If there is a duplicate, the schema file will take precedence over the default instance of this table in the data model. If a schema file is present in Location that does not match an existing table or view, a new table or view entry is added to the data model of the driver.
Input
| Name | Type | Required | Accepts Output Streams | Description |
| TableName | String | True | False | Specify the name of the Cloudant table for which the schema will be created. This ensures that the generated schema reflects the structure of the selected dataset. |
| FileName | String | False | False | Provide the full file path and file name where the generated schema should be saved. If this value is not specified, the schema will instead be returned in the FileData or FileStream output. For example, 'C:\\Users\\User\\Desktop\\Cloudant\\schema.rsd'. |
| SimplifyNames | String | False | False | Indicate whether column names in the generated schema should be simplified for readability. When enabled (default), column names are shortened or adjusted to remove special characters. |
| FileStream | String | False | True | Supply an output stream instance where the generated schema data will be written. This option is used only when FileName is not specified, allowing the schema to be consumed programmatically instead of being stored as a physical file. |
Result Set Columns
| Name | Type | Description |
| Result | String | Shows whether the schema creation process completed successfully, confirming that the schema was generated and is available in the chosen output format. |
| FileData | String | Returns the generated schema as a Base64-encoded string. This output is provided only if neither FileName nor FileStream was specified, allowing direct use or further processing of the schema without saving it to disk. |