diff options
author | asimfarooq5 <asimfarooq5@gmail.com> | 2022-12-14 15:32:47 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-12-20 10:49:00 -0500 |
commit | 074c1471958e155e79a3392ec65dc629012119c5 (patch) | |
tree | 6dbb42cddb9a4945ff4155afb42e937ed0a1903b | |
parent | deef63c190a423ed7a6d340df17a6318492c1fb2 (diff) | |
download | sqlalchemy-074c1471958e155e79a3392ec65dc629012119c5.tar.gz |
Add MACCADDR8 for PGCompiler
Add MACCADDR8 for PGCompiler
Closes: #8393
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8393
Pull-request-sha: 837a68eba3e31e0acbb7c47ee87bca4e9def7648
Change-Id: I87e4999eb8d82662ff8ab409c98dc57edd7fd271
(cherry picked from commit 33f15740a0b72bae64fc2c2f6d0f9724cfe9164a)
-rw-r--r-- | doc/build/changelog/changelog_14.rst | 2 | ||||
-rw-r--r-- | doc/build/changelog/unreleased_14/8393.rst | 7 | ||||
-rw-r--r-- | doc/build/dialects/postgresql.rst | 3 | ||||
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/__init__.py | 2 | ||||
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/base.py | 12 | ||||
-rw-r--r-- | test/dialect/postgresql/test_types.py | 1 |
6 files changed, 26 insertions, 1 deletions
diff --git a/doc/build/changelog/changelog_14.rst b/doc/build/changelog/changelog_14.rst index 6ca71530a..ef40bcc37 100644 --- a/doc/build/changelog/changelog_14.rst +++ b/doc/build/changelog/changelog_14.rst @@ -719,7 +719,7 @@ This document details individual issue-level changes made throughout :tickets: 8196 Fixed a crash of the mypy plugin when using a lambda as a Column - default. Pull request curtesy of tchapi. + default. Pull request courtesy of tchapi. .. change:: diff --git a/doc/build/changelog/unreleased_14/8393.rst b/doc/build/changelog/unreleased_14/8393.rst new file mode 100644 index 000000000..fab9eb04c --- /dev/null +++ b/doc/build/changelog/unreleased_14/8393.rst @@ -0,0 +1,7 @@ +.. change:: + :tags: usecase, postgresql + :tickets: 8393 + :versions: 2.0.0b5 + + Added the PostgreSQL type ``MACADDR8``. + Pull request courtesy of Asim Farooq. diff --git a/doc/build/dialects/postgresql.rst b/doc/build/dialects/postgresql.rst index 4e8fb98d9..c591ab000 100644 --- a/doc/build/dialects/postgresql.rst +++ b/doc/build/dialects/postgresql.rst @@ -31,6 +31,7 @@ they originate from :mod:`sqlalchemy.types` or from the local dialect:: JSON, JSONB, MACADDR, + MACADDR8, MONEY, NUMERIC, OID, @@ -110,6 +111,8 @@ construction arguments, are as follows: .. autoclass:: MACADDR +.. autoclass:: MACADDR8 + .. autoclass:: MONEY .. autoclass:: OID diff --git a/lib/sqlalchemy/dialects/postgresql/__init__.py b/lib/sqlalchemy/dialects/postgresql/__init__.py index 12d9e9444..262e160d8 100644 --- a/lib/sqlalchemy/dialects/postgresql/__init__.py +++ b/lib/sqlalchemy/dialects/postgresql/__init__.py @@ -30,6 +30,7 @@ from .base import INET from .base import INTEGER from .base import INTERVAL from .base import MACADDR +from .base import MACADDR8 from .base import MONEY from .base import NUMERIC from .base import OID @@ -80,6 +81,7 @@ __all__ = ( "UUID", "BIT", "MACADDR", + "MACADDR8", "MONEY", "OID", "REGCLASS", diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 9ad8379e2..aceec887e 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -1679,6 +1679,13 @@ class MACADDR(sqltypes.TypeEngine): PGMacAddr = MACADDR +class MACADDR8(sqltypes.TypeEngine): + __visit_name__ = "MACADDR8" + + +PGMacAddr8 = MACADDR8 + + class MONEY(sqltypes.TypeEngine): r"""Provide the PostgreSQL MONEY type. @@ -2232,6 +2239,7 @@ colspecs = { sqltypes.JSON: _json.JSON, } + ischema_names = { "_array": _array.ARRAY, "hstore": _hstore.HSTORE, @@ -2260,6 +2268,7 @@ ischema_names = { "bit": BIT, "bit varying": BIT, "macaddr": MACADDR, + "macaddr8": MACADDR8, "money": MONEY, "oid": OID, "regclass": REGCLASS, @@ -3007,6 +3016,9 @@ class PGTypeCompiler(compiler.GenericTypeCompiler): def visit_MACADDR(self, type_, **kw): return "MACADDR" + def visit_MACADDR8(self, type_, **kw): + return "MACADDR8" + def visit_MONEY(self, type_, **kw): return "MONEY" diff --git a/test/dialect/postgresql/test_types.py b/test/dialect/postgresql/test_types.py index 564554f66..1a5cdb647 100644 --- a/test/dialect/postgresql/test_types.py +++ b/test/dialect/postgresql/test_types.py @@ -2719,6 +2719,7 @@ class SpecialTypesTest(fixtures.TablesTest, ComparesTables): Column("bitstring", postgresql.BIT(4)), Column("addr", postgresql.INET), Column("addr2", postgresql.MACADDR), + Column("addr4", postgresql.MACADDR8), Column("price", postgresql.MONEY), Column("addr3", postgresql.CIDR), Column("doubleprec", postgresql.DOUBLE_PRECISION), |