You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Objects of the ipaddress module can now be passed as parameters in pg and pgdb, also inline (format_query(), query_formatted() with inline=True, and all parameters in pgdb) and as elements of arrays and records. Addresses and interfaces are adapted as inet, networks as cidr, as in psycopg 3. Arrays of inet and cidr (and of other types unknown to PyGreSQL, such as enums) can now also be written to table columns with DB.insert() and DB.update().
The values are still returned as strings by default. To get ipaddress objects, set the new typecast functions:
frompg.castimportcast_cidr, cast_inet# or from pgdb.castpg.set_typecast('inet', cast_inet) # or pgdb.set_typecastpg.set_typecast('cidr', cast_cidr)
Making this the default would be a breaking change, so I opened #119 for 7.0.
Activity
Cito commentedon Nov 22, 2026
Objects of the
ipaddressmodule can now be passed as parameters inpgandpgdb, also inline (format_query(),query_formatted()withinline=True, and all parameters inpgdb) and as elements of arrays and records. Addresses and interfaces are adapted asinet, networks ascidr, as in psycopg 3. Arrays ofinetandcidr(and of other types unknown to PyGreSQL, such as enums) can now also be written to table columns withDB.insert()andDB.update().The values are still returned as strings by default. To get
ipaddressobjects, set the new typecast functions:Making this the default would be a breaking change, so I opened #119 for 7.0.