Skip to main content
Ctrl+K
Jörg Faschingbauer - Home Jörg Faschingbauer - Home
  • Training Courses
  • About
  • Blog
  • Training Courses
  • About
  • Blog

Section Navigation

  • Course Descriptions
  • Pricing, Organizational
  • Log Of Past Courses
  • Complete Slide Material
    • Linux
    • Python Programming
      • Python: The Language Fundamentals
      • Python: More Language Features
      • Python: Project/Package Management
      • Python: Miscellaneous Topics
        • CSV Files
        • Databases
        • Pandas
        • Machine Learning, Artificial Intelligence
        • MQTT
        • XML: ElementTree (etree)
        • The import Statement (incomplete)
        • Visual Studio Code for Python Programming
        • Encoding
      • Python: Draft Topics
      • Python Links
      • Exercises
    • The C Programming Language
    • C++ < 11
    • C++ >= 11
    • Design Patterns With C++
    • C++: TODO List
    • C++: Miscellaneous Live-Hacking
    • C++ Code
    • C++ Exercises
    • CMake
    • Is Software A Craft? Software Is A Craft! ⟶ Clean Code
    • Unit Testing With googletest
  • Training Courses
  • Complete Slide Material
  • Python Programming
  • Python: Miscellaneous Topics
  • Databases
  • DBAPI 2: PostgreSQL

DBAPI 2: PostgreSQL#

  • DBAPI 2 Example: Postgres

DBAPI 2 Example: Postgres#

  • Does not come with Python installation

  • ⟶ http://initd.org/psycopg/

  • Entry point: connect()

  • Parameters best seen in the C-API documentation (http://www.postgresql.org/docs/8.3/static/libpq-connect.html)

  • connect(const char* conninfo): string containing name=value pairs

  • ⟶ keyword arguments in psycopg2

import psycopg2
connection = psycopg2.connect(
    host='localhost',
    dbname='schwammerldb',
    user='ich',
    password='secret')
On this page
  • DBAPI 2 Example: Postgres

© Copyright 2019-2025 (GPLv3), Jörg Faschingbauer.

Created using Sphinx 8.1.3.

Built with the PyData Sphinx Theme 0.16.1.

Show Source