Author: cito
Date: Thu Feb 4 15:56:19 2016
New Revision: 818
Log:
Add list of supported data types.
Modified:
trunk/docs/about.rst
trunk/docs/contents/pg/adaptation.rst
trunk/docs/contents/pgdb/adaptation.rst
trunk/pg.py
trunk/pgdb.py
Modified: trunk/docs/about.rst
==============================================================================
--- trunk/docs/about.rst Thu Feb 4 15:18:08 2016 (r817)
+++ trunk/docs/about.rst Thu Feb 4 15:56:19 2016 (r818)
@@ -28,7 +28,7 @@
**PyGreSQL** is a Python module that interfaces to a PostgreSQL database.
It embeds the PostgreSQL query library to allow easy use of the powerful
-PostgreSQL features from a Python script.
+PostgreSQL features from a Python script or application.
PyGreSQL is developed and tested on a NetBSD system, but it also runs on
most other platforms where PostgreSQL and Python is running. It is based
Modified: trunk/docs/contents/pg/adaptation.rst
==============================================================================
--- trunk/docs/contents/pg/adaptation.rst Thu Feb 4 15:18:08 2016
(r817)
+++ trunk/docs/contents/pg/adaptation.rst Thu Feb 4 15:56:19 2016
(r818)
@@ -12,6 +12,40 @@
detail in case you want to better understand or change the default
behavior of PyGreSQL.
+Supported data types
+--------------------
+
+The following automatic data type conversions are supported by PyGreSQL
+out of the box. If you need other automatic type conversions or want to
+change the default conversions, you can achieve this by using the methods
+explained in the next two sections.
+
+================================== ==================
+PostgreSQL Python
+================================== ==================
+char, bpchar, name, text, varchar str
+bool bool
+bytea bytes
+int2, int4, int8, oid, serial int [#int8]_
+int2vector list of int
+float4, float8 float
+numeric, money Decimal
+date datetime.date
+time, timetz datetime.time
+timestamp, timestamptz datetime.datetime
+interval datetime.timedelta
+hstore dict
+json, jsonb list or dict
+array list
+record tuple
+================================== ==================
+
+.. note::
+
+ Elements of arrays and records will also be converted accordingly.
+
+ .. [#int8] int8 is converted to long in Python 2
+
Adaptation of parameters
------------------------
When you use the higher level methods of the classic :mod:`pg` module like
Modified: trunk/docs/contents/pgdb/adaptation.rst
==============================================================================
--- trunk/docs/contents/pgdb/adaptation.rst Thu Feb 4 15:18:08 2016
(r817)
+++ trunk/docs/contents/pgdb/adaptation.rst Thu Feb 4 15:56:19 2016
(r818)
@@ -12,6 +12,40 @@
detail in case you want to better understand or change the default
behavior of PyGreSQL.
+Supported data types
+--------------------
+
+The following automatic data type conversions are supported by PyGreSQL
+out of the box. If you need other automatic type conversions or want to
+change the default conversions, you can achieve this by using the methods
+explained in the next two sections.
+
+================================== ==================
+PostgreSQL Python
+================================== ==================
+char, bpchar, name, text, varchar str
+bool bool
+bytea bytes
+int2, int4, int8, oid, serial int [#int8]_
+int2vector list of int
+float4, float8 float
+numeric, money Decimal
+date datetime.date
+time, timetz datetime.time
+timestamp, timestamptz datetime.datetime
+interval datetime.timedelta
+hstore dict
+json, jsonb list or dict
+array list
+record tuple
+================================== ==================
+
+.. note::
+
+ Elements of arrays and records will also be converted accordingly.
+
+ .. [#int8] int8 is converted to long in Python 2
+
Adaptation of parameters
------------------------
Modified: trunk/pg.py
==============================================================================
--- trunk/pg.py Thu Feb 4 15:18:08 2016 (r817)
+++ trunk/pg.py Thu Feb 4 15:56:19 2016 (r818)
@@ -856,9 +856,8 @@
defaults = {'char': str, 'bpchar': str, 'name': str,
'text': str, 'varchar': str,
'bool': cast_bool, 'bytea': unescape_bytea,
- 'int2': int, 'int4': int, 'serial': int, 'int8': long,
+ 'int2': int, 'int4': int, 'serial': int, 'int8': long, 'oid': int,
'hstore': cast_hstore, 'json': cast_json, 'jsonb': cast_json,
- 'oid': long, 'oid8': long,
'float4': float, 'float8': float,
'numeric': cast_num, 'money': cast_money,
'date': cast_date, 'interval': cast_interval,
Modified: trunk/pgdb.py
==============================================================================
--- trunk/pgdb.py Thu Feb 4 15:18:08 2016 (r817)
+++ trunk/pgdb.py Thu Feb 4 15:56:19 2016 (r818)
@@ -386,9 +386,8 @@
defaults = {'char': str, 'bpchar': str, 'name': str,
'text': str, 'varchar': str,
'bool': cast_bool, 'bytea': unescape_bytea,
- 'int2': int, 'int4': int, 'serial': int, 'int8': long,
+ 'int2': int, 'int4': int, 'serial': int, 'int8': long, 'oid': int,
'hstore': cast_hstore, 'json': jsondecode, 'jsonb': jsondecode,
- 'oid': long, 'oid8': long,
'float4': float, 'float8': float,
'numeric': Decimal, 'money': cast_money,
'date': cast_date, 'interval': cast_interval,
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql