Python Connector for PostgreSQL

Data types - Python Connector for PostgreSQL

Data types

The following table describes the supported PostgreSQL data types and their mapping to the Python data types. The type codes returned in the description cursor attribute can be used in the addtypecast() cursor method.

PostgreSQL data type Type code Python data type

character

507

str

character varying

508

str

text

517

str

smallint

515

int

integer

511

int

bigint

501

int

serial

516

int

bigserial

502

int

real

514

float

double precision

510

float

numeric

513

numeric

date

509

datetime.date

time

518

datetime.time

time with time zone

519

datetime.time

timestamp

520

datetime.datetime

timestamp with time zone

521

datetime.datetime

bytea

506

binary

point

562

point

lseg

559

lseg

line

558

line

path

561

path

polygon

563

polygon

box

553

box

circle

555

circle

© 2022-2025 Devart. All Rights Reserved. Request Support Python Connectors Forum Provide Feedback