From 4d6efd06aa87cbbe2b42df260376acf43e30c308 Mon Sep 17 00:00:00 2001 From: Daniel Hall Date: Tue, 28 Jun 2022 15:03:34 -0400 Subject: [PATCH] 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 --- doc/build/dialects/postgresql.rst | 6 +++++ lib/sqlalchemy/dialects/postgresql/types.py | 26 +++++++++++++++++++++ 2 files changed, 32 insertions(+) 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 -- 2.47.2