SQL Parser allows you to benefit from rules and forecast capabilities for Oracle SQL Scripts that are being packaged through the DIRECT, DDL_DIRECT, or SQLFILE package methods.
Currently, the SQL Parser only supports Oracle SQL scripts. |
In rare cases, the SQL Parser may incorrectly model a statement found in a provided SQL script, which may lead to erroneous rules and forecast violations (or the erroneous lack thereof). If you encounter such behavior, please contact our Technical Support team so that the matter may be addressed. |
SQL Parser is a global setting that applies to the entire project. As a global setting, there is no way to selectively enable SQL Parser. Instead, SQL Parser can be selectively disabled for specific folders after the global setting has been enabled. To enable the SQL Parser:
There were fixes and improvements to SQL Parser for Oracle in Liquibase Enterprise/Datical DB version 7.12. Please upgrade to version 7.12 or higher if you are using SQL Parser.
In the GUI, navigate to the Deployment Settings section of the project settings (Settings tab), then check the checkbox next to 'Enable Parser'. NOTE: As a project-level setting, checking the checkbox for 'Enable Parser' will enable SQL Parser globally for the entire project.
The setting is represented in the datical.project
file by enableSqlParser=true.
enableSqlParser=[true | false] |
You can selectively disable the SQL Parser after it has been enabled, either at the folder level or on the change set level.
You can disable SQL Parser at the folder level either temporarily or permanently in the metadata.properties file for that folder:
Set disableSqlParser=true
in the metadata.properties
file for any folders that you do not want SQL Parser to process.
disableSqlParser=[true | false] |
You can disable SQL Parser for a specific change set by manually editing the changelog.xml to add disableSqlParser="true":
Add disableSqlParser=true
in the appdba:sqlplus
section of the change set for a specific change set you do not want SQL Parser to process.
<changeSet appdba:scriptChecksum="9f8a11051d1478faf2752baacb76cf0e" author="J Doe" created="2020-08-10 18:37+0000" datical:origFileName="adding_test_new_001.sql" datical:origFilePath="scripts/sql_direct" datical:version="1" datical:versionStrategy="DEPLOY_ALL" id="20200810183704986_adding_test_new_001" labels="509,deploy-test1,deploy-test1,adding_test_new_001.sql"> <appdba:sqlplus disableSqlParser="true" enableRollbackOnError="true" path="sql/20200810183704986_adding_test_new_001.sql" removeSpools="First" schemaName="SCHEMA1"/> <comment>Test script</comment> |
If a Forecast fails for a script, you may be able to temporarily turn off SQL Parser to work around it. Determine which script caused the failure first (Forecast Report). See which directory the script with the forecast failure is in (such as sql_direct or sql or ddl_direct folder
).
To work around the problem, turn off SQL Parser temporarily using disableSqlParser=true
in metadata.properties
for the folder where the script failed, and then run deployPackager again.
IMPORTANT: You should reset disableSqlParser=false
in metadata.properties
after the script is packaged successfully.
If you have a directory hierarchy for SQL scripts remember that metadata.properties
effects the directory it is in and all subdirectories. Set the property in the directory that is most local to the script that causes the packaging error. The directory hierarchy root is as follows:
ddl_direct,
sql_direct,
or sql
folderpackageMethod=DDL_DIRECT,
packageMethod=DIRECT, or packageMethod=SQLFILE
Follow this procedure after you encounter the Forecast failure and identify the script causing the problem:
ddl_direct,
sql_direct,
or sql
folder). disableSqlParser=true
in the metadata.properties
file (create the file if it does not exist). Check it in. disableSqlParser=false
in the metadata.properties
file. Check it in. If the reason for the Forecast failure was that a statement earlier in the script was unable to be forecast and a statement later in the script depended on it, there may be a different work around possibility. If it is appropriate for this type of script, you may consider splitting the single script into multiple smaller scripts so the statement with the forecast failure is in a separate script from the other statements that depend on it.
If a script is packaged into changesets with parser turned off, the changesets carry that setting forward as they are deployed to later steps in the pipeline. |
See Using the metadata.properties file.
Selectively disabling the SQL Parser using the |
When SQL parsing is enabled, a file is produced after any of the following operations:
The file contains the modeled changes produced by the SQL Parser. It can be used for debugging. The produced file is stored in the project in the following directory:
Reports/<year>/<date>/<dbdef>/[forecast | deploy]/parser_output/<filename>_<timestamp>.xml
Using SQL Parser is available only for the following databases. See each section for additional information about object support and limitations.
SQL Parser requires statement blocks to be separated by a forward slash "/". Expand for examples:
|
For constraints that require a unique index (such as addPrimaryKey or addUniqueConstraint), the SQL Parser does not model creating a unique index. Expand for example:
In this example, it might be the case that the unique index "COUNTRY_C_ID_PKX" had to be first created in schema "SCHEMA1" in table "COUNTRIES" before the primary key can be added. The limitation is that the unique index creation is not modeled by SQL Parser because that cannot be determined without first interacting with the target database and finding out whether the unique index already exists or not. Same goes to the statements with
is modeled to
|
The following statements will not be modeled by the SQL Parser and will instead just be run as provided. Note that this list is applicable for Datical DB versions 6.15 and higher. (The list for Datical DB versions 6.14 and lower was somewhat different.)
Do not use SQL Parser with the following statements.