]> 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)
committerFederico Caselli <cfederico87@gmail.com>
Mon, 19 Dec 2022 19:27:30 +0000 (20:27 +0100)
Add MACCADDR8 for PGCompiler

Closes: #8393
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/8393
Pull-request-sha: 837a68eba3e31e0acbb7c47ee87bca4e9def7648

Change-Id: I87e4999eb8d82662ff8ab409c98dc57edd7fd271

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

index 9e279acadebeb1b87c0be92e0d4eddebab5f4320..248b2041cabf89625bfe1f16ce54833d68ab5aad 100644 (file)
@@ -734,7 +734,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_20/8393.rst b/doc/build/changelog/unreleased_20/8393.rst
new file mode 100644 (file)
index 0000000..7584ae9
--- /dev/null
@@ -0,0 +1,6 @@
+.. change::
+    :tags: usecase, postgresql
+    :tickets: 8393
+
+    Added the PostgreSQL type ``MACADDR8``.
+    Pull request courtesy of Asim Farooq.
index 2f541b5abd2d6af1574ecf8358dfa6ff6c8c839c..b53a1518a564223a85737b1f00649896984ee92f 100644 (file)
@@ -323,6 +323,7 @@ they originate from :mod:`sqlalchemy.types` or from the local dialect::
         JSON,
         JSONB,
         MACADDR,
+        MACADDR8,
         MONEY,
         NUMERIC,
         OID,
@@ -412,6 +413,8 @@ construction arguments, are as follows:
 
 .. autoclass:: MACADDR
 
+.. autoclass:: MACADDR8
+
 .. autoclass:: MONEY
 
 .. autoclass:: OID
index 7890541ffde05c3afdae4ad7d6bebea54ae0dbe9..97d5ac84e1077decab2bcf1fce440e76f37568f1 100644 (file)
@@ -69,6 +69,7 @@ from .types import CIDR
 from .types import INET
 from .types import INTERVAL
 from .types import MACADDR
+from .types import MACADDR8
 from .types import MONEY
 from .types import OID
 from .types import REGCLASS
@@ -99,6 +100,7 @@ __all__ = (
     "UUID",
     "BIT",
     "MACADDR",
+    "MACADDR8",
     "MONEY",
     "OID",
     "REGCLASS",
index f9108094f21ec4bdc090b32d576694cd04f5c12b..5893a1a9148901c409ebbe5d5c9365e377b4246d 100644 (file)
@@ -1419,6 +1419,7 @@ from .types import CIDR as CIDR
 from .types import INET as INET
 from .types import INTERVAL as INTERVAL
 from .types import MACADDR as MACADDR
+from .types import MACADDR8 as MACADDR8
 from .types import MONEY as MONEY
 from .types import OID as OID
 from .types import PGBit as PGBit  # noqa: F401
@@ -1426,6 +1427,7 @@ from .types import PGCidr as PGCidr  # noqa: F401
 from .types import PGInet as PGInet  # noqa: F401
 from .types import PGInterval as PGInterval  # noqa: F401
 from .types import PGMacAddr as PGMacAddr  # noqa: F401
+from .types import PGMacAddr8 as PGMacAddr8  # noqa: F401
 from .types import PGUuid as PGUuid
 from .types import REGCLASS as REGCLASS
 from .types import TIME as TIME
@@ -1583,6 +1585,7 @@ colspecs = {
     UUID: PGUuid,
 }
 
+
 ischema_names = {
     "_array": _array.ARRAY,
     "hstore": _hstore.HSTORE,
@@ -1617,6 +1620,7 @@ ischema_names = {
     "bit": BIT,
     "bit varying": BIT,
     "macaddr": MACADDR,
+    "macaddr8": MACADDR8,
     "money": MONEY,
     "oid": OID,
     "regclass": REGCLASS,
@@ -2390,6 +2394,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 72703ff814a59dd69a08755ed4cf8b558d1fda2c..b275deaf92f29e87a74546fda3e31d5f7858041b 100644 (file)
@@ -46,6 +46,13 @@ class MACADDR(sqltypes.TypeEngine[str]):
 PGMacAddr = MACADDR
 
 
+class MACADDR8(sqltypes.TypeEngine[str]):
+    __visit_name__ = "MACADDR8"
+
+
+PGMacAddr8 = MACADDR8
+
+
 class MONEY(sqltypes.TypeEngine[str]):
 
     r"""Provide the PostgreSQL MONEY type.
index dcde497b46326292f269deea13802db91b3d2ec2..b8dc0f3c0911e94153d6918142d9d32fd962a741 100644 (file)
@@ -3076,6 +3076,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),