ODBC guide

Read incidents incrementally (by updated date)


Fetch incidents updated after a specific date. This pattern is recommended for incremental loads and scheduled sync jobs.

Use this approach to avoid full table scans, reduce API calls, and improve overall performance.

The date filter can be specified using either a static date value or a dynamic date expression. Dynamic date expressions allow relative date calculations and are useful for automated jobs.

Examples of dynamic date expressions:

  • yesterday – incidents updated yesterday
  • today – incidents updated today
  • today-1d – incidents updated in the last 24 hours
  • monthstart – incidents updated since the beginning of the month
  • monthend-1d – incidents updated up to the last day of the previous month
-- Incrementally fetch incidents updated after a given date
SELECT *
FROM get_table_rows
WITH(
TableName='incident',

-- Load only incidents updated in the last 24 hours
Query='sys_updated_on>=<<today-1d,FUN_TO_DATETIME>>'

--OR Updated after static date time
--Query='sys_updated_on>=2025-01-01T23:23:59'
--Query='sys_updated_on>=2025-01-01'

--Other examples of placeholder function usage
--Query='sys_updated_on>=<<monthstart-7d,FUN_TO_DATETIME>>'
--Query='sys_updated_on>=<<monthstart-5d+1y,FUN_TO_DATETIME>>'

)