[sqlalchemy] default values when generating DDL

2014-07-28 Thread Luca Clementi
Hi, I am trying to use my ORM mapping definitions to create my database schema and I'm looking at the defaults values. Apparently when I defined a column, if I use default_server='value' it will get into the DDL for my DB, but then my object instances will not have a default value when I

Re: [sqlalchemy] default values when generating DDL

2014-07-28 Thread Michael Bayer
On Jul 28, 2014, at 5:54 PM, Luca Clementi luca.cleme...@gmail.com wrote: Hi, I am trying to use my ORM mapping definitions to create my database schema and I'm looking at the defaults values. Apparently when I defined a column, if I use default_server='value' it will get into the DDL for

Re: [sqlalchemy] Default values

2011-08-06 Thread Mike Conley
You can get to the column default value. class MyTable(Base): __tablename__ = 'table' id = Column(Integer, primary_key=True) name = Column(String, default='new name') def __init__(self, name=None): if name is not None: self.name =

Re: [sqlalchemy] Default values

2011-08-06 Thread Mark Erbaugh
On Aug 6, 2011, at 7:18 AM, Mike Conley wrote: You can get to the column default value. class MyTable(Base): __tablename__ = 'table' id = Column(Integer, primary_key=True) name = Column(String, default='new name') def __init__(self, name=None):

[sqlalchemy] Default values

2011-08-05 Thread Mark Erbaugh
In a declaratively created table, is there an automatic way to get a new instance of the class object to be populated with values specified in a 'default' clause? i.e. class MyTable(Base): __tablename__ = 'table' name = Column(String, default='new name') ... newRow =

Re: [sqlalchemy] Default values

2011-08-05 Thread Stefano Fontanelli
Il 05/08/11 19.29, Mark Erbaugh ha scritto: In a declaratively created table, is there an automatic way to get a new instance of the class object to be populated with values specified in a 'default' clause? i.e. class MyTable(Base): __tablename__ = 'table' name =

Re: [sqlalchemy] Default values

2011-08-05 Thread Mark Erbaugh
On Aug 5, 2011, at 2:00 PM, Stefano Fontanelli wrote: Il 05/08/11 19.29, Mark Erbaugh ha scritto: In a declaratively created table, is there an automatic way to get a new instance of the class object to be populated with values specified in a 'default' clause? i.e. class

Re: [sqlalchemy] Default values

2011-08-05 Thread Stefano Fontanelli
Il 05/08/11 20.33, Mark Erbaugh ha scritto: On Aug 5, 2011, at 2:00 PM, Stefano Fontanelli wrote: Il 05/08/11 19.29, Mark Erbaugh ha scritto: In a declaratively created table, is there an automatic way to get a new instance of the class object to be populated with values specified in a

[sqlalchemy] Default values not correctly parsed from DB

2010-05-19 Thread Andrew
We're using ORM to do unit testing, so we're mocking up the commit message to do nothing, basically creating a long transaction that's rolled back at the end of the test. However, I am running into the following problem. Assume we've mapped a table to class MyTable with a varchar `name' and a

[sqlalchemy] default values in reflected tables

2009-07-27 Thread Jamie Bullock
Hi, Is there a way in SQLalchemy to have the values of a mapped reflected table object set to default column values derived from the database backend? e.g. if column 'bar' of table 'foo' in my database has a default of True, I would like to be able to do the following: foo_table =

[sqlalchemy] default values for columns in select mappers

2008-09-03 Thread wim . verhavert
Hi all, I just started playing with SQLAlchemy today (after several years of plain SQL experience) and I must say I'm impressed. I'm reading my way through the docs now, but there is one thing I can't seem to find. Let me briefly explain the situation. I was given the task of rewriting a