Current trunk. sqlite
Simple example below in which a Boolean with default = True is being
created with default of 0. The other defaults in the example below
work fine.
item_table = Table('item',metadata,
Column('id', Integer, primary_key=True),
Column('name',String(25)),
Column('truedefault', Boolean, default=True),
Column('falsedefault', Boolean, default=False),
Column('stringdefault',String(25), default='howdy'),
Column('timestamp', DateTime,
default=datetime.datetime.now),
)
class Item(object):
def __init__(self, name):
self.name = name
mapper(Item, item_table)
###########################################
>>> item = Item("Hello World")
>>> session.save(item)
>>> session.flush()
2006-10-28 08:44:37,849 INFO sqlalchemy.engine.base.Engine.0x..b4 BEGIN
2006-10-28 08:44:37,856 INFO sqlalchemy.engine.base.Engine.0x..b4
INSERT INTO item (name, truedefault, falsedefault, stringdefault,
timestamp) VALUES (?, ?, ?, ?, ?)
2006-10-28 08:44:37,856 INFO sqlalchemy.engine.base.Engine.0x..b4
['Hello World', 0, 0, 'howdy', '2006-10-28 08:44:37.855698']
2006-10-28 08:44:37,860 INFO sqlalchemy.engine.base.Engine.0x..b4
COMMIT
>>>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sqlalchemy
-~----------~----~----~----~------~----~------~--~---