Skip to content

Allow creating a Trino table using dataframe #524

Closed
@andythsu

Description

@andythsu

Describe the feature

Hello, we'd like to support creating a Trino table using dataframe.
API would be simple, something like

conn = connect()
cursor = conn.cursor()
df = pd.Dataframe()
cursor.insert_df("foo", df, 800*1000) # 800k

where

def insert_df(table: str, df: pd.Dataframe, max_size: int):
    :param table: table to create/replace.
    :param df: dataframe to insert.
    :param max_size: max number of characters allowed for the SQL query text. This should be <= query.max-length set on Trino to prevent 
    QUERY_TEXT_TOO_LARGE error.

This should be enough for phase 1. For future iterations, we can think about how to upsert data to an existing table....

Describe alternatives you've considered

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions