catherinedevlin / ipython-sql

%%sql magic for IPython, hopefully evolving into full SQL client
MIT License
1.79k stars 369 forks source link

Loading from dsn file is not working #219

Open sivankumar86 opened 1 year ago

sivankumar86 commented 1 year ago

Steps to reproduce the issue.

  1. Create dsn file
  2. Run below commands %config SqlMagic.dsn_filename='./dsn.ini' %sql –section [DB_CONFIG_1]

I get below error instead of connecting to db

"Environment variable $DATABASE_URL not set, and no connect string given."

idomic commented 1 year ago

@sivankumar86 check out this section here Your syntax is off, use %sql --section DB_CONFIG_1. Also make sure you have psycopg2 installed and there are no spaces in the .ini file. Just tested via Jupysql and a local postgres and it works!