snowflakedb / snowflakedb/snowflake-connector-python

SNOW-1457704: Allows write_pandas to pass Cursor in addition to Connection.

Open
#1,957 1 comment 0 reactions 1 assignee View on GitHub

@sfc-gh-yixie is already working on this.

Since Jun 4, 2024.

feature status-triage_done
Dominant language
Python
Stars
730
Forks
574
Avg merge
5h 45m
Merged PRs (30d)
16

Description

What is the current behavior?

You can pass Connection to write_pandas, but not Cursor.

with snowflake_conn.cursor() as cursor:
    df = cursor.execute("...").fetch_pandas_all()
    write_pandas(cursor.connection, df) # <- See this
What is the desired behavior?

Allow Cursor to be passed to write_pandas.

with snowflake_conn.cursor() as cursor:
    df = cursor.execute("...").fetch_pandas_all()
    write_pandas(cursor, df)
How would this improve snowflake-connector-python?

The write_pandas process can be described more intuitively while dealing with cursors using with.

References and other background

This is a minor modification, but we believe it is a natural writing permit given the definition of connection cursor in the PEP 249 – Python Database API.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.