Reputation: 179
Just started using colaboratory and would like to run sql queries against a postgresql db. Is this possible on colaboratory. I've used magic sql with jupyter nb to do this.
Upvotes: 2
Views: 1576
Reputation: 179
It was a matter of using 2 %% instead of 1 that was giving me an error. What I'm running is this:
! pip install ipython-sql
! pip install psycopg2
%sql postgres://<connect string>
%sql select tablename from pg_tables;
I saw an example where there sql was run with %%sql and when I tried that I got an error. Everything is running well now. Rebecca
Upvotes: 3