title: Postgres Python Query import pg vs import psycopg2
body: <p>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.</p>
  
  <p>The code currently has:</p>
  
  <pre><code>import pg
  con = pg.connect(...)
  </code></pre>
  
  <p>and a bunch of calls to:</p>
  
  <pre><code>con.query(...)
  </code></pre>
  
  <p>I found this  example on SO: <a href="https://stackoverflow.com/questions/1874113/checking-if-a-postgresql-table-exists-under-python-and-probably-psycopg2">Checking if a postgresql table exists under python (and probably Psycopg2)
  </a> but I am unsure if <code>psycopg2</code> is the same as <code>pg</code> and I can't seem to find any documentation on <code>pg</code> so I don't know if <code>import pg</code> can do <code>con.exucute(...)</code> simular to how <code>psycopg2</code> can.  <br></p>
  
  <p>Everytime I search for <code>pg</code> I get documentation for <code>psycopg2</code>.</p>
  
  <p>Anyone know the differences between the two?
  Can I use <code>con.execute()</code> and <code>con.cursor()</code> for <code>pg</code>?</p>