Movatterモバイル変換


[0]ホーム

URL:


You don’t need a vector database - just use Postgres for everything. Read the case study on switching from Pinecone to Neon
PostgreSQL Tutorial
PostgreSQL Tutorial
/PostgreSQL Python

PostgreSQL Python

This PostgreSQL Python section shows you how to work with PostgreSQL using thePython programming language.

Python has various database drivers for PostgreSQL. Currently, thepsycopg is the most popular PostgreSQL database adapter for the Python language. The psycopg fully implements the Python DB-API 2.0 specification.

The current version of the psycopg is 2 or psycopg2. The psycopg2 database adapter is implemented in C as alibpq wrapper resulting in both fast and secure. The psycopg2 provides many useful features such as client-side and server-sidecursors, asynchronous notification and communication, COPY command support, etc.

Besides, the psycopg2 driver supports many Python types out-of-the-box. The psycopg2 matches Python objects to thePostgreSQL data types, e.g., list to the array, tuples to records, and dictionary tohstore.  If you want to customize and extend the type adaption, you can use a flexible object adaption system.

This PostgreSQL Python section covers the most common activities for interacting with PostgreSQL in Python applications:

For demonstration purposes, we will use thesuppliers sample database. The following picture illustrates the structure of thesuppliers database:

PostgreSQL Python Sample Database DiagramThesuppliers database has the following tables:

  1. vendors table: stores vendor data.
  2. parts table: stores parts data.
  3. parts_drawings table: stores the drawing of a part.
  4. vendor_parts table: stores the data of which parts are supplied by which vendor.

Last updated on

Was this page helpful?
Thank you for your feedback!

[8]ページ先頭

©2009-2025 Movatter.jp