MoinMoin Logo
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Navigation

  • Start
  • Sitemap
Revision 1 as of 2025-02-07 14:08:11
  • Python
  • psycopg2

psycopg2

Psycopg is the most popular PostgreSQL database adapter for the Python programming language.

  • https://www.psycopg.org/docs/usage.html

Install debian globally

   1 sudo apt install python3-psycopg2

Select example

   1 import psycopg2
   2 conn = psycopg2.connect("dbname=dbx user=userx password=1234 host=localhost")
   3 cur = conn.cursor()
   4 cur.execute("SELECT * FROM myschemax.tablex;")
   5 x=cur.fetchall()
   6 for item in x: 
   7     print(item)
   8 cur.close()
  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01