From: Daniel Hall Date: Tue, 28 Jun 2022 19:03:34 +0000 (-0400) Subject: 8152: add documentation for postgresql dialect time and timestamp types X-Git-Tag: rel_2_0_0b1~205^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d6efd06aa87cbbe2b42df260376acf43e30c308;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git 8152: add documentation for postgresql dialect time and timestamp types add documentation for postgresql dialect time and timestamp types This pull request is: - [ X] A documentation / typographical error fix - Good to go, no issue or tests are needed **Have a nice day!** Closes: #8185 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8185 Pull-request-sha: 2b76fe080babd72f8e5615b34cb544abbc446a28 Change-Id: Ib71b35d106d0d0686e5551f07b88486b6c59624d --- diff --git a/doc/build/dialects/postgresql.rst b/doc/build/dialects/postgresql.rst index ea0c2aa42a..7cd413e25e 100644 --- a/doc/build/dialects/postgresql.rst +++ b/doc/build/dialects/postgresql.rst @@ -92,6 +92,12 @@ construction arguments, are as follows: .. autoclass:: REGCLASS +.. autoclass:: TIMESTAMP + :members: __init__ + +.. autoclass:: TIME + :members: __init__ + .. autoclass:: TSVECTOR .. autoclass:: UUID diff --git a/lib/sqlalchemy/dialects/postgresql/types.py b/lib/sqlalchemy/dialects/postgresql/types.py index 374adcac1f..81b6771872 100644 --- a/lib/sqlalchemy/dialects/postgresql/types.py +++ b/lib/sqlalchemy/dialects/postgresql/types.py @@ -114,13 +114,39 @@ class REGCLASS(sqltypes.TypeEngine[str]): class TIMESTAMP(sqltypes.TIMESTAMP): + + """Provide the PostgreSQL TIMESTAMP type.""" + + __visit_name__ = "TIMESTAMP" + def __init__(self, timezone=False, precision=None): + """Construct a TIMESTAMP. + + :param timezone: boolean value if timezone present, default False + :param precision: optional integer precision value + + .. versionadded:: 1.4 + + """ super(TIMESTAMP, self).__init__(timezone=timezone) self.precision = precision class TIME(sqltypes.TIME): + + """PostgreSQL TIME type.""" + + __visit_name__ = "TIME" + def __init__(self, timezone=False, precision=None): + """Construct a TIME. + + :param timezone: boolean value if timezone present, default False + :param precision: optional integer precision value + + .. versionadded:: 1.4 + + """ super(TIME, self).__init__(timezone=timezone) self.precision = precision