summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2022-12-20 15:47:30 +0000
committerGerrit Code Review <gerrit@ci3.zzzcomputing.com>2022-12-20 15:47:30 +0000
commit6ac7e947f7fafbc41b90e67c1c215c59eaa7d5b0 (patch)
treea29b83e688d3637d6e40e6bd2d680a7c9c00497f
parent414e5ff5d73bd4c2e2ece6deca13ccd9d3d5fc2a (diff)
parent33f15740a0b72bae64fc2c2f6d0f9724cfe9164a (diff)
downloadsqlalchemy-6ac7e947f7fafbc41b90e67c1c215c59eaa7d5b0.tar.gz
Merge "Add MACCADDR8 for PGCompiler" into main
-rw-r--r--doc/build/changelog/changelog_14.rst2
-rw-r--r--doc/build/changelog/unreleased_20/8393.rst6
-rw-r--r--doc/build/dialects/postgresql.rst3
-rw-r--r--lib/sqlalchemy/dialects/postgresql/__init__.py2
-rw-r--r--lib/sqlalchemy/dialects/postgresql/base.py7
-rw-r--r--lib/sqlalchemy/dialects/postgresql/types.py7
-rw-r--r--test/dialect/postgresql/test_types.py1
7 files changed, 27 insertions, 1 deletions
diff --git a/doc/build/changelog/changelog_14.rst b/doc/build/changelog/changelog_14.rst
index 9e279acad..248b2041c 100644
--- a/doc/build/changelog/changelog_14.rst
+++ b/doc/build/changelog/changelog_14.rst
@@ -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
index 000000000..7584ae91d
--- /dev/null
+++ b/doc/build/changelog/unreleased_20/8393.rst
@@ -0,0 +1,6 @@
+.. change::
+ :tags: usecase, postgresql
+ :tickets: 8393
+
+ 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 8f4dc1e72..ce6022c55 100644
--- a/doc/build/dialects/postgresql.rst
+++ b/doc/build/dialects/postgresql.rst
@@ -323,6 +323,7 @@ they originate from :mod:`sqlalchemy.types` or from the local dialect::
JSON,
JSONB,
MACADDR,
+ MACADDR8,
MONEY,
NUMERIC,
OID,
@@ -403,6 +404,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 d2e213bbc..a89082943 100644
--- a/lib/sqlalchemy/dialects/postgresql/__init__.py
+++ b/lib/sqlalchemy/dialects/postgresql/__init__.py
@@ -75,6 +75,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
@@ -107,6 +108,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 3fb29812b..80455b949 100644
--- a/lib/sqlalchemy/dialects/postgresql/base.py
+++ b/lib/sqlalchemy/dialects/postgresql/base.py
@@ -1436,6 +1436,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
@@ -1443,6 +1444,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 REGCONFIG as REGCONFIG # noqa: F401
@@ -1601,6 +1603,7 @@ colspecs = {
UUID: PGUuid,
}
+
ischema_names = {
"_array": _array.ARRAY,
"hstore": _hstore.HSTORE,
@@ -1635,6 +1638,7 @@ ischema_names = {
"bit": BIT,
"bit varying": BIT,
"macaddr": MACADDR,
+ "macaddr8": MACADDR8,
"money": MONEY,
"oid": OID,
"regclass": REGCLASS,
@@ -2450,6 +2454,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/lib/sqlalchemy/dialects/postgresql/types.py b/lib/sqlalchemy/dialects/postgresql/types.py
index 49fc70ba3..eda651146 100644
--- a/lib/sqlalchemy/dialects/postgresql/types.py
+++ b/lib/sqlalchemy/dialects/postgresql/types.py
@@ -45,6 +45,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.
diff --git a/test/dialect/postgresql/test_types.py b/test/dialect/postgresql/test_types.py
index 4832d81d9..caa758b0d 100644
--- a/test/dialect/postgresql/test_types.py
+++ b/test/dialect/postgresql/test_types.py
@@ -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),