metadata doesn't serialize naming convention

Issue #3362 resolved
Michael Bayer
repo owner created an issue
from sqlalchemy import Table, Column, MetaData, Integer
import pickle

m = MetaData(naming_convention={"pk": "%(table_name)s_pk"})
t = Table('t', m, Column('id', Integer, primary_key=True))

m2 = pickle.loads(pickle.dumps(m))

t2a = Table('t2', m, Column('id', Integer, primary_key=True))
t2b = Table('t2', m2, Column('id', Integer, primary_key=True))

assert t2a.primary_key.name == t2b.primary_key.name

Comments (2)

  1. Michael Bayer reporter
    • Fixed issue where a :class:.MetaData object that used a naming convention would not properly work with pickle. The attribute was skipped leading to inconsistencies and failures if the unpickled :class:.MetaData object were used to base additional tables from. fixes #3362

    → <<cset 55c26710a1f6>>

  2. Log in to comment