Mike- I'm not sure if this is a bug or docs incompatibility issue, and I know metadata may be going away soon... but I'm leaning towards a bug.
I was setting up a test suite for a Pyramid plugin, and used the Alembic naming conventions (https://alembic.sqlalchemy.org/en/latest/naming.html) as Pyramid references them too. Using the sqlite driver, this generates a fatal exception: sqlalchemy.exc.InvalidRequestError: Naming convention including %(constraint_name)s token requires that constraint is explicitly named. Tracing things around, it seems due to `sqlalchemy.Boolean` creating a constraint by default. Switching Boolean to Unicode immediately fixes this; passing in `create_constraint=False` works too. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Standard imports import sqlalchemy import sqlalchemy.orm from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Boolean, Integer, Column, Unicode, ForeignKey, String NAMING_CONVENTION = { "ix": 'ix_%(column_0_label)s', "uq": "uq_%(table_name)s_%(column_0_name)s", "ck": "ck_%(table_name)s_%(constraint_name)s", "fk": "fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s", "pk": "pk_%(table_name)s" } _metadata = sqlalchemy.MetaData(naming_convention=NAMING_CONVENTION) Base = declarative_base(metadata=_metadata) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Define some models that inherit from Base class Foo(Base): __tablename__ = 'foo' id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True) status_id = sqlalchemy.Column(sqlalchemy.Boolean, nullable=True, default =None) # the following works: # status_id = sqlalchemy.Column(sqlalchemy.Unicode, nullable=True, default=None) # the following works: # status_id = sqlalchemy.Column(sqlalchemy.Boolean(create_constraint=True), nullable=True, default=None) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # set the engine engine = sqlalchemy.create_engine('sqlite:///:memory:', echo=True) Base.metadata.create_all(engine) -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/ac139582-d690-48c1-ac18-cf1536f37750%40googlegroups.com.