]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add MACCADDR8 for PGCompiler
authorasimfarooq5 <asimfarooq5@gmail.com>
Wed, 14 Dec 2022 20:32:47 +0000 (15:32 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 20 Dec 2022 15:49:00 +0000 (10:49 -0500)
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)

doc/build/changelog/changelog_14.rst
doc/build/changelog/unreleased_14/8393.rst [new file with mode: 0644]
doc/build/dialects/postgresql.rst
lib/sqlalchemy/dialects/postgresql/__init__.py
lib/sqlalchemy/dialects/postgresql/base.py
test/dialect/postgresql/test_types.py

index 6ca71530aa0f4b312bbec85bb7ecc7d9597b2940..ef40bcc3704a4a21337568fa19752665ca48b2ce 100644 (file)
@@ -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 (file)
index 0000000..fab9eb0
--- /dev/null
@@ -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.
index 4e8fb98d95e1438edbfbc65f5d163d3ebc65a277..c591ab000662ff14a31b12255531f9d05af667a5 100644 (file)
@@ -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
index 12d9e94443dbc274f8d349e4b80f4fa03d1371d5..262e160d8d0479971629ad4cdee3fa59d7ecb479 100644 (file)
@@ -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",
index 9ad8379e26b7ce97a40b84e6a8184a8310cf4e55..aceec887e17ea1360839dc2cce280f990090eaf4 100644 (file)
@@ -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"
 
index 564554f668ffdee002e1b5756217cacd8392d045..1a5cdb6474d6d74b9061da71e54f5424a7cb7ae4 100644 (file)
@@ -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),