1

Note: I posted the question at https://github.com/catherinedevlin/ipython-sql/issues/149

I can connect hive/presto using create_engine like this

from sqlalchemy.engine import create_engine
conn = create_engine(
    'presto://user@host:port',
    connect_args={'protocol': 'https',
                  'requests_kwargs': {
    'auth': HTTPBasicAuth('user', 'pw'),
    'verify': '/cert.pem',
    }}
)
df = pd.read_sql("SELECT * FROM dw.my_table", conn)

However, if I use ipython-sql, how should I connect?

From the doc, it seems only support string passed to create_engine, something like this

%%sql postgresql://will:longliveliz@localhost/shakes
select * from character
where abbrev = 'ALICE

How can I specify additional configs in connect_args?

ZK Zhao
  • 19,885
  • 47
  • 132
  • 206

1 Answers1

0

ipython-sql does not support this, as it expects a connection string. However, you can use JupySQL (an actively maintained fork that keeps 100% compatibility).

You can do something like this:

%%sql conn
select * from character
where abbrev = 'ALICE

Documentation

Eduardo
  • 1,383
  • 8
  • 13