- changed component to schema
- changed title to overhaul metadata table storage, apply to declarative
- changed milestone to 0.7.0
- assigned issue to
overhaul metadata table storage, apply to declarative
Issue #1893
resolved
diff -r 1402a608ebc28031ce11dec9ed6a90785f09294d lib/sqlalchemy/ext/declarative.py
--- a/lib/sqlalchemy/ext/declarative.py Wed Aug 25 11:01:46 2010 -0400
+++ b/lib/sqlalchemy/ext/declarative.py Wed Aug 25 19:19:35 2010 -0400
@@ -1173,6 +1173,8 @@
return _GetColumns(cls._decl_class_registry[key](key))
elif key in cls.metadata.tables:
return cls.metadata.tables[key](key)
+ elif key.replace("_", ".") in cls.metadata.tables:
+ return cls.metadata.tables[".")](key.replace("_",)
else:
return sqlalchemy.__dict__[key](key)
Comments (5)
-
reporter -
reporter unfortunately that idea breaks for tablename + schemaname are the same. so next idea:
m.schemas.x.foo m.tables.bar
for declarative, not sure if there's any real solution here.
-
reporter Patch has been updated, leaving mostly the original scheme in place, except metadata.tables becomes a frozendict. Changing my mind regarding fancy schema.table accessors for now.
-
reporter - changed status to resolved
diff:@2336b1cebfcb2f304e09cbc2a0e8bb3fb3a9ceeb:08e5c35c2dd6ee3344bfe9077c6036a182baf5c8
-
reporter - removed milestone
Removing milestone: 0.7.0 (automated comment)
- Log in to comment
so attached is a patch that hacks this out in a way I don't really like. Here's what I want, and it will be 0.7:
So ".tables" becomes just like ".columns". Its a dict/prop interface that is definitely not mutable (its almost like OrderedProperties but I don't want it to have an ordering to start and i really dont want any mutators on it, so make it something new).
remove()
as always will remove a table.