...
Notice that we directly used the ‘doc_id’ label in the WHERE clause.
Labels are necessary for the 4 types of queries needed when configuring your connector, please check the section about these queries in Database crawling simplified configuration documentation.This is really important, specifically when you need to use MCF variables as labels in the different types of queries specified in the Database crawling simplified configuration documentation ! The Version query, Access Token query and Data query are affected by this behavior as they use the “idfield” in the where clause !
For example, here is the default data query:
Code Block | ||
---|---|---|
| ||
SELECT idfield AS $(IDCOLUMN), urlfield AS $(URLCOLUMN), datafield AS $(DATACOLUMN) FROM documenttable WHERE idfield IN $(IDLIST) |
Assuming we have a table named “documenttable” with “idfield”, “urlfield” and “datafield” as columns, this data query will not work as it is ! because the “idfield” is labeled $(IDCOLUMN)
and the WHERE
clause refers to “idfield”, not $(IDCOLUMN)
. This query will cause the following type of error during execution:
Code Block |
---|
Caused by: java.sql.SQLException: Invalid column name: idfield |
Instead, the correct data query would be:
Code Block | ||
---|---|---|
| ||
SELECT idfield AS $(IDCOLUMN), urlfield AS $(URLCOLUMN), datafield AS $(DATACOLUMN) FROM documenttable WHERE $(IDCOLUMN) IN $(IDLIST) |