snowflakedb / snowflakedb/snowflake-connector-python
SNOW-3308363: Feature request: connection-level `force_microsecond_precision` parameter
@sfc-gh-snow-drivers-warsaw-dl is already working on this.
Since Mar 30, 2026.
- Dominant language
- Python
- Stars
- 730
- Forks
- 574
- Avg merge
- 5h 45m
- Merged PRs (30d)
- 16
Description
What is the current behavior?
When working with timestamp columns that contain values outside the nanosecond range, the per-batch Arrow timestamp resolution becomes inconsistent (timestamp[ns] vs timestamp[us]). This causes pyarrow.lib.ArrowInvalid schema mismatch errors when combining batches.
The existing force_microsecond_precision=True parameter solves this perfectly, but currently is only available on cursor.fetch_arrow_batches() and cursor.fetch_arrow_all().
What is the desired behavior?
This parameter should also be available as a connection-level parameter on snowflake.connector.connect(), so that all Arrow fetches from that connection default to microsecond precision without requiring the flag on every call.
Proposed API
import snowflake.connector
# connection-level default — all fetch_arrow_* calls use microsecond precision
con = snowflake.connector.connect(
account='...',
user='...',
# ... other params
force_microsecond_precision=True, # new parameter
)
# these now default to force_microsecond_precision=True
cursor = con.cursor()
cursor.execute('SELECT * FROM my_table')
table = cursor.fetch_arrow_all() # no flag needed, inherits from connection
# can still override per-call if needed
table = cursor.fetch_arrow_all(force_microsecond_precision=False)
Alternatively, this could be a session parameter or a cursor-level default — any scope broader than per-fetch-call would help.
How would this improve snowflake-connector-python?
This could provide solution in the following scenarios:
-
Downstream libraries can use it. Libraries like ibis-framework call
cursor.fetch_arrow_batches()internally without passing the flag. Users have no way to inject it. A connection-level default would allow ibis (and other libraries) to inherit the behavior automatically viaibis.snowflake.from_connection(sf_con). -
Repetitive and error-prone. In analysis workflows with many queries, forgetting the flag on a single fetch call causes a runtime error. A connection-level default eliminates this.
References and other background
Environment
- snowflake-connector-python: 4.3.0
- Python: 3.12
- OS: Windows
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.