Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support transactions (and pandas.to_sql / read_sql_table) #72

Closed
@C0DK

Description

@C0DK

It's a great project, and truly helps me in a variety of ways. However, I am having a few issues when utilizing it with Pandas.

When reading a table I would like to do:

defread(self,catalog_name:str,schema_name:str,table_name:str    )->DataFrame:withself._get_connection(catalog_name)asconnection:iterator=pd.read_sql_table(schema=schema_name,table_name=table_name,con=connection,            )

This should return a pandas dataframe.

However, I am required to do the following lacking features from your otherwise great connection.

defread(self,catalog_name:str,schema_name:str,table_name:str    )->pd.DataFrame:withself._get_connection(catalog_name)asconnection:query=f"SELECT * FROM{catalog_name}.{schema_name}.{table_name}"self.logger.debug("Running query '%s'",query)df=pd.read_sql(query,connection)self.logger.debug(df)returndf

Similarly I cannot use theto_sql on a dataframe where i'd like to do something like the following:

defwrite(self,dataframe:pd.DataFrame,catalog_name:str,schema_name:str,table_name:str,    )->pd.DataFrame:withself._get_connection(catalog_name)asconnection:dataframe.to_sql(name=table_name,con=connection,schema=schema_name)

Both fail

databricks.sql.exc.NotSupportedError: Transactions are not supported on Databricks

Versions:

python 3.10.6databricks-sql-connector==2.2.1pandas==1.5.2

Metadata

Metadata

Assignees

No one assigned

    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


      [8]ページ先頭

      ©2009-2025 Movatter.jp