Hi!
Thanks for your very prompt
answer.
Unluckily, my mails were a little bit unprecise:
So, I wondered why the following happened:
prop = get_mapper(Participation).get_property('remark')
c=prop.columns[0]
c
Column(u'remark', PGText(length=None, convert_unicode=False,
assert_unicode=None), table=<%(188392684 participation)s>, nullable=False)
gives me a column
c.server_default
no server default
c2=iter(c.base_columns).next()
c2
Column(u'remark', PGText(length=None, convert_unicode=False,
assert_unicode=None), table=<participation>, nullable=False,
server_default=DefaultClause(<sqlalchemy.sql.expression._TextClause object at
0xb3b17cc>, for_update=False))
c2.server_default
DefaultClause(<sqlalchemy.sql.expression._TextClause object at 0xb3b17cc>,
for_update=False)
Somehow in base_columns the server default is detected.
It is a little bit unclear to me, why the server_default is detected in c2, but
not in c.
In fact I used the base_columns now as a workaround for RUM, but it feels quite
hacky.
By the way, I simply *love* SA.
Moreover, I am very impressed,
that (while of course unable to use them) my postgresql db contains partial
indices.
That's a very good sign for the reflection code.
Cheers,
Michael
Am 15.04.2010 um 15:19 schrieb Michael Bayer:
>
> On Apr 15, 2010, at 7:26 AM, Michael Brickenstein wrote:
>
>>
>>
>> On 15 Apr., 13:03, Michael Brickenstein <[email protected]> wrote:
>>> Sorry, forgot to mention, I had the same behaviour with SA 0.5.6 and
>>> 0.5.8.
>>> Cheers,
>>
>>>> In former times, I used
>>>> prop.server_default to find out, that there is an default of ''.
>> Sorry, that's wrong it has always been the columns[0], that I have to
>> inspect.
>> Nevertheless, the question for an official way remains, so far the
>> situation is the following:
>> c.server_default
>> -> None
>>
>> c2=iter(c.base_columns).next()
>> -> DefaultClause(<sqlalchemy.sql.expression._TextClause object at
>> 0xa2507ac>, for_update=False)
>>
>> Is that a bug or a feature?
>
>
> server_default is where we put whatever server side defaults were detected
> during reflection. They reflect as a sqlalchemy.schema.DefaultClause, "arg"
> is a TextClause representing what was received, and calling str() on that
> gives you the ultimate value. The TextClause is so that we can
> differentiate it from a literal python-defined value that would require
> quoting.
>
>
> --
> 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?hl=en.
--
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?hl=en.