case_sensitive

12 views
Skip to first unread message

jo

unread,
Dec 9, 2008, 5:22:30 AM12/9/08
to sqlalchemy
Hi all,

Trying to migrate from 0.3.10 to 0.5 I have this error:

sqlalchemy.exc.ArgumentError: Unknown UniqueConstraint argument(s):
'case_sensitive'

how can I define the case_sensitive=True for a unique constraint?

thank you,
j


Glauco

unread,
Dec 9, 2008, 5:32:40 AM12/9/08
to sqlal...@googlegroups.com
jo ha scritto:
http://www.sqlalchemy.org/trac/browser/sqlalchemy/tags/rel_0_4_8/CHANGES


case_sensitive=(True|False) setting removed from schema items, since
checking this state added a lot of method call overhead and there was no
decent reason to ever set it to False. Table and column names which are
all lower case will be treated as case-insenstive (yes we adjust for
Oracle's UPPERCASE style too).


Glauco

--
+------------------------------------------------------------+
Glauco Uri
glauco(at)sferacarta.com

Sfera Carta SoftwareŽ info(at)sferacarta.com
Via Bazzanese,69 Casalecchio di Reno(BO) - Tel. 051591054
+------------------------------------------------------------+


jo

unread,
Dec 9, 2008, 5:50:24 AM12/9/08
to sqlal...@googlegroups.com
Maybe I'm using the 'case_sensitive' in a wrong way.
Here what I want to reach :

create unique index myname on mytable (lower(mycolumn));

How can I create it on sqlalachemy?

j


Glauco ha scritto:

Michael Bayer

unread,
Dec 9, 2008, 12:39:25 PM12/9/08
to sqlal...@googlegroups.com
I think this would involve sending func.lower(table.c.somecolumn) to
the Index construct.

jose

unread,
Dec 10, 2008, 2:19:59 AM12/10/08
to sqlal...@googlegroups.com
I tried it, as you suggested me, Michael...
Index('valuta_desc_uniq', func.lower(valuta.c.descrizione), unique=True)

File "/usr/lib/python2.4/site-packages/sqlalchemy/schema.py", line
1045, in __init__
self._init_items(*columns)
File "/usr/lib/python2.4/site-packages/sqlalchemy/schema.py", line
1052, in _init_items
self.append_column(column)
File "/usr/lib/python2.4/site-packages/sqlalchemy/schema.py", line
1065, in append_column
self._set_parent(column.table)
AttributeError: '_Function' object has no attribute 'table'

Michael Bayer

unread,
Dec 10, 2008, 10:18:52 AM12/10/08
to sqlal...@googlegroups.com
OK you might have to use the DDL() construct instead, if Index doesn't
support func() yet.

jose

unread,
Dec 10, 2008, 11:06:31 AM12/10/08
to sqlal...@googlegroups.com
Hi,

What this message means?

self.save_objects(trans, task)
File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/unitofwork.py", line 1023, in save_objects
task.mapper.save_obj(task.polymorphic_tosave_objects, trans)
File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/mapper.py", line 1195, in save_obj
mapper._postfetch(connection, table, obj, c, c.last_updated_params())
File "/usr/lib/python2.4/site-packages/sqlalchemy/orm/mapper.py", line 1263, in _postfetch
elif v != params.get_original(c.key):
TypeError: can't compare offset-naive and offset-aware datetimes


both values are datetime type

v = 2008-12-10 14:28:17.537583
params.get_original(c.key) = 2008-12-10 16:47:43.209162+01:00

Any idea?

j

Reply all
Reply to author
Forward
0 new messages