I'm not positive about this but if you are talking about the integer column,
all defaults have to be a string or some SQLAlchemy function so you'd want:

type = sa.Column(sa.types.Integer, nullable=0, default='1')

On Wed, Jul 13, 2011 at 7:37 AM, ddarko <ddarko...@gmail.com> wrote:
> class AccountHistory(Base):
>    id                          = sa.Column(sa.types.Integer,
primary_key=1)
>    date                        = sa.Column(sa.types.DateTime, nullable=0,
> default=sa.func.current_timestamp())
>    type                        = sa.Column(sa.types.Integer, nullable=0,
default=1)
>
>    def getdefault(self, name):
>        return self.....name....default ?
>
> eg:
> print(AccountHistory().getdefault('type'))
> 1
>
>
> I would like to write a function that returns a default value defined
> for that column in the table.
> How does it make?
>
> --
> You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> To unsubscribe from this group, send email to
sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to