From c812cf5f4eec922ab73476ad1a169880b8dfa098 Mon Sep 17 00:00:00 2001 From: Daniel Hall Date: Tue, 28 Jun 2022 11:25:41 -0700 Subject: [PATCH] (doc) add documentation for postgresql dialect time and timestamp types --- doc/build/dialects/postgresql.rst | 6 ++++++ lib/sqlalchemy/dialects/postgresql/types.py | 24 +++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/doc/build/dialects/postgresql.rst b/doc/build/dialects/postgresql.rst index ea0c2aa42a..75af0fea4e 100644 --- a/doc/build/dialects/postgresql.rst +++ b/doc/build/dialects/postgresql.rst @@ -71,6 +71,12 @@ construction arguments, are as follows: .. autoclass:: INET +.. autoclass:: TIMESTAMP + :members: __init__ + +.. autoclass:: TIME + :members: __init__ + .. autoclass:: INTERVAL :members: __init__ diff --git a/lib/sqlalchemy/dialects/postgresql/types.py b/lib/sqlalchemy/dialects/postgresql/types.py index 374adcac1f..eea88ddc9b 100644 --- a/lib/sqlalchemy/dialects/postgresql/types.py +++ b/lib/sqlalchemy/dialects/postgresql/types.py @@ -114,13 +114,37 @@ 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.3