Skip to content

Guides

Sessions

The Snowflake session settings conversion assumes, and how to pass yours.

Some results depend on session settings, such as the time zone a timestamp is read in. Converted SQL gives Snowflake’s result only where both sessions run in UTC: Snowflake’s TIMEZONE and DuckDB’s TimeZone must be 'UTC'.

Pass your Snowflake session parameters with --session NAME=VALUE, one flag each, or set them for every run under [project.session] in the project’s sqlquack.toml (see Projects). A --session flag replaces the project’s value for one run.

Parameter Effect
TIMEZONE UTC, or no TIMEZONE, converts statements whose result depends on the time zone. Any other value refuses them.
DATABASE, SCHEMA Complete relation names written without them. See Projects.
QUOTED_IDENTIFIERS_IGNORE_CASE true reads quoted names case-insensitively, as Snowflake does.

QUERY_TAG, USE_CACHED_RESULT, STATEMENT_TIMEOUT_IN_SECONDS, STATEMENT_QUEUED_TIMEOUT_IN_SECONDS, ABORT_DETACHED_QUERY and CLIENT_SESSION_KEEP_ALIVE are accepted and ignored, because they can’t change a result. A parameter left unset takes Snowflake’s documented default. Any other parameter, or a value conversion has no recording for, is refused by name with SQ0007, so a misspelt name never falls back to the defaults.

Statements whose result depends on the session time zone rely on the session_timezone_utc known difference. It holds when both the Snowflake and the DuckDB session run in UTC, which is what a session without TIMEZONE, or with TIMEZONE = "UTC", says. The defaults allow it then, and --strict counts it too, as a fact the session states. See session_timezone_utc.

A TIMEZONE other than UTC refuses them, in every mode, and a note says so:

$ sqlquack convert orders.sql --session TIMEZONE=Europe/London
SELECT "ORDERS"."ORDER_ID" AS "ORDER_ID"
FROM "ORDERS" AS "ORDERS"
sqlquack convert: note: the session time zone is Europe/London, not UTC, so statements that depend on it are refused
sqlquack convert: done, converted
  • convert --json names the recorded session conversion ran under as profile, such as utc-v1, or utc-qiic-v1 with QUOTED_IDENTIFIERS_IGNORE_CASE = true.
  • census and index take no session parameters.