Info – The object with the information about the enum to register.Ĭontext – The context where to register the adapters. Register the adapters to load and dump a enum type. register_enum ( info : EnumInfo, context : Optional = None, enum : Optional ] = None, *, mapping : Optional, Sequence ] ] ] = None ) # Latter’s documentation for generic usage, especially theĪfter fetch(), it contains the labels definedĪfter register_enum() is called, it will contain the Python type EnumInfo ( name : str, oid : int, array_oid : int, labels : Sequence ) #ĮnumInfo is a subclass of TypeInfo: refer to the The registered PostgreSQL enum is loaded back as the registered PythonĬlass. fetch() andĮnums classes, both pure and mixed-in, are dumped by name. If the enum is registered (using EnumInfo. Of such enums you will have to find their OIDs using () PostgreSQL enums are loaded as Python strings. It’s dumped by default according to int rules). Mix-in enums are dumped according to their mix-in type (because a class MyIntEnum(int, Enum) is more specifically an int than an Enum, so Obtain a connection in a supported style using the options connectionĬhanged in version 3.1: In previous version dumping pure enums is not supported and raise a If your server is configured with different settings by default, you can With a different setting is not supported. ![]() IntervalStyle is postgres loading interval data in text format Representation in other formats is ambiguous.įurthermore, at the time of writing, the only supported value for The connection DateStyle is set to ISO format time and time zone Loading timestamp with time zone in text format is only supported if Implementing the added capability please see this example for a reference. Or the time 24:00 to 00:00) and write a subclass of the default loaders Instance mapping every value greater than to date.max, If you need to handle these values you can define your own mapping (for Loading these values will raise a DataError. Represented by the Python datetime objects:ĭates and timestamps after the year 9999, the special value “infinity” ĭates and timestamps before the year 1, the special value “-infinity” ![]() PostgreSQL date and time objects can represent values that cannot be Tzinfo implementation resulting in the time’s Tzinfo, such as the ones returned by Postgres, or by whatever fetchone () datetime.time(14, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=7200)))ĭumping Python time objects is only supported with fixed offset execute ( "SELECT ' 12:00Z'::timestamptz::timetz" ). fetchone () datetime.time(13, 0, tzinfo=datetime.timezone(datetime.timedelta(seconds=3600))) # UTC+2 in summer > conn. ![]() execute ( "SET TIMEZONE to 'Europe/Rome'" ) # UTC+1 in winter > conn.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |