What's the proper way to define a "MAC Address" for a column type? #978
-
First Check
Commit to Help
Example Codefrom sqlmodel import SQLModel, Field, Relationship
import sqlalchemy as sa
class SensorDevice(SQLModel, table=True):
__tablename__: str = "sensor_device"
id: int | None = Field(default=None, primary_key=True)
mac_address: str = Field(sa_column=sa.Column(sa.types.MACADDR)) # Using MACADDR type DescriptionWhat is the common proper way to set a MAC Address via SQLModel (PostgreSQL) ?
Operating SystemLinux, Windows, macOS Operating System DetailsNo response SQLModel Version0.0.19 Python VersionPython 3.12.4 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Answered by
YuriiMotov
Aug 20, 2025
Replies: 1 comment
-
This type is dialect-specific (postgresql). from sqlalchemy.dialects.postgresql import MACADDR |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
YuriiMotov
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This type is dialect-specific (postgresql).
Use correct import path