Sorry, forgot to mention, I had the same behaviour with SA 0.5.6 and
0.5.8.
Cheers,
Michael

On 15 Apr., 12:27, Michael Brickenstein <brickenst...@mfo.de> wrote:
> Hi!
>
> I have reflected my table from the db (Postgresql 8.4.2, tried psyco
> 2.0.12 and 2.0.14) using
>
> Table(name, metadata, autoload=True, autoload_with=engine)
>
> After that I map the table.
> When later in my app, I try to access the default values from the DB,
> I use
> the columnproperty:
>
> from owconf.model import Participation
> from rumalchemy.util import get_mapper
> prop = get_mapper(Participation).get_property('remark')
> prop
> <sqlalchemy.orm.properties.ColumnProperty object at 0xac5dcec>
>
> c=prop.columns[0]
> repr(c.default)
> repr(c.server_default)
>
> prop = get_mapper(Participation).get_property('number_of_companions')
>
> This is the reflection of a simple text field:
>
> remark                  | text    | not null default ''::text
>
> In former times, I used
> prop.server_default to find out, that there is an default of ''.
> This does not exist any more at that place, so I have inspected the
> property:
>
> c=prop.columns[0]
> repr(c.default)
> -> None
> repr(c.server_default)
> -> None
>
> The same occurs with integer fields like that:
>
>  number_of_companions    | integer | not null default 0
>
> Which is now the proper way to find out the right default for the
> column?
>
> The functionality is very useful for the RUM CRUD application.
>
> http://python-rum.org/
>
> Cheers,
> Michael

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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