Skip to main content
Version: 1.26.0 (latest)

dlt.extract.incremental.sql

to_sqlglot_filter

def to_sqlglot_filter(
incremental: "Incremental[Any]",
apply_lag: bool = True,
destination_capabilities: Optional[DestinationCapabilitiesContext] = None
) -> Optional[sge.Expression]

View source on GitHub

Build a sqlglot WHERE expression that filters rows to the current incremental window.

Arguments:

  • incremental Incremental[Any] - Incremental instance whose cursor is filtered. Works on bound and unbound instances.
  • apply_lag bool - When True, lag is applied to the lower bound; when False, the raw cached start_value is used.
  • destination_capabilities Optional[DestinationCapabilitiesContext] - Caps used to shape the timestamp cast and literal format (precision, tz handling, sqlite cast drop). When None, a generic tz-aware cast is emitted.

Returns:

  • Optional[sge.Expression] - A sqlglot boolean expression suitable for use as a WHERE clause, or None when filtering is not possible.

This demo works on codespaces. Codespaces is a development environment available for free to anyone with a Github account. You'll be asked to fork the demo repository and from there the README guides you with further steps.
The demo uses the Continue VSCode extension.

Off to codespaces!

DHelp

Ask a question

Welcome to "Codex Central", your next-gen help center, driven by OpenAI's GPT-4 model. It's more than just a forum or a FAQ hub – it's a dynamic knowledge base where coders can find AI-assisted solutions to their pressing problems. With GPT-4's powerful comprehension and predictive abilities, Codex Central provides instantaneous issue resolution, insightful debugging, and personalized guidance. Get your code running smoothly with the unparalleled support at Codex Central - coding help reimagined with AI prowess.