I'm am working on editing a python script and I need to check if a table exists. The code works however since I am now trying to check if a table exists I need to first understand what is going on.
The code currently has:
import pg
con = pg.connect(...)
and a bunch of calls to:
con.query(...)
I found this example on SO: Checking if a postgresql table exists under python (and probably Psycopg2)
but I am unsure if psycopg2
is the same as pg
and I can't seem to find any documentation on pg
so I don't know if import pg
can do con.exucute(...)
simular to how psycopg2
can.
Everytime I search for pg
I get documentation for psycopg2
.
Anyone know the differences between the two?
Can I use con.execute()
and con.cursor()
for pg
?