apache / apache/arrow-adbc

docs: demonstrate more complex SQLAlchemy integration

Open
#2,079 14 comments 0 reactions 0 assignees View on GitHub
Type: question
Dominant language
C#
Stars
627
Forks
217
Avg merge
17h
Merged PRs (30d)
57

Description

I am curious if there is a way to use SQLAlchemy along the ADBC driver for our postgres database. Often in SQLAlchemy I can switch between drivers by simply altering the create_engine() call. We have a lot of SQL logic written with SQLAlchemy queries (which allow us to switch between different SQL flavors). I tried to make it work with the connection object but it does not really work. I get errors like the following.

`sqlalchemy.exc.NoInspectionAvailable: No inspection system is available for object of type `

an example code could look like this

from sqlalchemy import MetaData, Table, select, Column, Integer
from adbc_driver_postgresql import dbapi
import pandas as pd

with dbapi.connect('some_valid_DB_URL') as con

metadata = MetaData()
tmp_id_table = Table('tmp_table', metadata,
Column('id_', Integer, primary_key=True),
prefixes=['TEMPORARY'])
metadata.create_all(con)

tmp_ids = pd.DataFrame(dict(id_=[1,2,3,4]))
tmp_ids.to_sql('tmp_table', con=con, if_exists='append',
index=False)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.