title: How to specify Schema in psycopg2 connection method?
body: <p>Using the psycopg2 module to connect to the PostgreSQL database using python. Able to execute all queries using the below connection method. Now I want to specify a different schema than public to execute my SQL statements. Is there any way to specify the schema name in the connection method?</p>
  <pre><code>conn = psycopg2.connect(host=&quot;localhost&quot;,
                              port=&quot;5432&quot;,
                              user=&quot;postgres&quot;,
                              password=&quot;password&quot;,
                              database=&quot;database&quot;,
                              )
  </code></pre>
  <p>I tried to specify schema directly inside the method.
  <code>schema=&quot;schema2&quot;</code>
  But I am getting the following programming error.</p>
  <pre><code>ProgrammingError: invalid dsn: invalid connection option &quot;schema&quot;
  </code></pre>