Here's a simple test case:
from sqlalchemy import *
import sqlalchemy.engine as engine
def test_default_with_key():
# we don't actually need a real db URI for this test
db = engine.create_engine('postgres://')
meta = BoundMetaData(db)
t = Table('default_test1', meta,
Column('col_name', String(20), key="colName",
default="imthedefault"),
)
compiled = t.insert().compile()
params = t.insert().compile().get_params()
context = db.dialect.create_execution_context()
context._process_defaults(db, lambda *a,**k: None, compiled,
params)
print params
assert params["colName"] == "imthedefault"
assert "col_name" not in params
test_default_with_key()
The params end up being {'col_name': 'imthedefault', 'colName': None}
which means it's using the column name and not the key when defaults
are processed.
~ Daniel
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users