As needed, you can insert custom SQL statements as part of the data import process. These custom SQL statements allow you to pre-filter the rows and columns of relational source data within the database, where performance is faster. This query method can also be used for wider operations on relational sources from
All queries are blindly executed. It is your responsibility to ensure that they are appropriate. Queries like
SQL statements are stored as part of the query instance for the object. If the same query is being made across multiple users using private connections, the SQL must be shared and entered by individual users.
NOTE: If a dataset created from custom SQL is shared, collaborators are not permitted to edit the custom SQL.
Each statement must be terminated with a semi-colon (
;) and a newline:
SELECT * FROM myDB.myTable;
SQL statements must be valid for the syntax of the target relational system.
Info For more information on SQL examples, see Supported SQL Syntax.
NOTE: Standard SQL syntax is supported. Legacy SQL syntax is not supported.
- If you modify the custom SQL statement when reading from a source, all samples generated based on the previous SQL are invalidated.
Declared variables are not supported.
- For each SQL statement, all columns must have an explicit name. Example:
Function references such as:
Must be specified as:
UPPER(col) as col_name
- In the Library page, click Import Data.
- In the Import Data page, select a connection.
- Within your source, locate the table from which you wish to import. Do not select the table.
Click the Preview icon to review the columns in the dataset.
Tip: You may wish to copy the database, table name, and column names to a text editor to facilitate generating your SQL statement.
Click Create Dataset with SQL. Enter or paste your SQL statement.
Through the custom SQL interface, it is possible to enter SQL statements that can delete data, change table schemas, or otherwise corrupt the targeted database. Please use this feature with caution.
NOTE: If this button is disabled and you have enabled the custom SQL feature, the connection that you are using may lack credentials. Please review the connection definition.
Create Dataset with SQL dialog
For more information, see Supported SQL Syntax.
To test the SQL, click Validate SQL. For details, see below.
To apply the SQL to the import process, click Create Dataset.
The customized source is added to the right panel. To re-edit, click Custom SQL.
Complete the other steps to define your imported dataset.
When the data is imported, it is altered or filtered based on your SQL statement.After dataset creation, you can modify the SQL, if needed. See Dataset Details Page.
Create with Variables
If parameterization has been enabled, you can specify variables as part of your SQL statement. Suppose you had table names like the following:
Provide a name for the variable, and click Save.
Through the Run Job page, you can specify overrides for the default value, so the same job definition can be used across all matching tables without much modification. For more information, see Run Job Page.
For more information on this feature, see Overview of Parameterization.
Create with timestamp parameter
For more information on SQL syntax and supported variations, see Supported SQL Syntax.
|D s also|