[sqlalchemy] Are sqlalchemy queries a generator?

2013-04-26 Thread alonn
so not to load too much into memory I should do something like:

for i in session.query(someobject).filter(idsomething)
print i

I'm guessing the answer is no, because of the nature of sql, but I'm not an 
expert so I'm asking.

Thanks for the help!

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




[sqlalchemy] sqlalchemy failing to commit somewhere (but fails silently) when trying to update data

2013-03-18 Thread alonn
Like all CRUD goes, I need to write some data to a table. when I write new 
data to the table, everything works like charm. the problem starts when I 
need to write data already existing in the table (actually updating some 
data with the same primary key).
the data just doesn't seem to be written to the table! I started with 
trying to update the data with session.merge(), but later tried a more 
brute force approach, of querying for the same primary_key in the table, 
deleting it and the adding and flushing the changed objects.
some where, if the basic add and flush failes the rest doesn't work.  I'll 
be glad for a clue here.

The code:

def flush(obj_Instance, id):

taking care of the sqlalchemy flushing
params:
Instance: an object Instance to flush into
id: the unique object instance id


DBSession2.add(obj_Instance)

try:

try:
DBSession2.flush()
print (flushed:, str(obj_Instance))
except (FlushError, IntegrityError) as err:
DBSession2.rollback()
if ('conflicts with persistent instance' in str(err)) or 
('Duplicate key was ignored' in str(err)):
transaction.begin()
#my original slick take:
DBSession2.merge(obj_instance) # but after it failed to 
update correctly I changed to a more brute force approach
#DBSession2.flush()  #to save the merge
#from here on trying to brute force it
#saving for further reference - another try
newInstance = deepcopy(obj_Instance)
print (deleting: %s % id)
DBSession2.query(type(obj_Instance)).filter_by(ids = 
id).delete()
DBSession2.flush() #at this point, I was so desperate for 
this to work I literated the code with flush commands.
DBSession2.add(newInstance)
DBSession2.flush()
return
else:
raise #handling the case of the same key problem isn't the 
source of conflicts

except Exception as err:  # supposed to find out the error type and 
message
# the code doesn't get here, only in real exceptions it was planned to 
catch, 3 rows in 10,000 uploaded to the db
#TODO: make this less general and more specific
print str(err)
write_log(num=id, msg=some sql or sqlalchemy error use num %s as 
id identifier with object: %s % (id, obj_Instance.name), timestamp=
datetime.now(), errtype=sql error, log=str(err))
DBSession2.rollback()
transaction.begin()

maybe this try/fail/rollback/merge or delete/insert new pattern is wrong 
(also I think pythonic - try and ask forgiveness,but  that would be for 
mike to judge)

using sqlalchemy 0.7.3 vs mssql 2005 with pyodbc 2.1.11 and tg 2.1 (the 
transaction manager comes with tg and I think is based transaction)

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




Re: [sqlalchemy] sqlalchemy failing to commit somewhere (but fails silently) when trying to update data

2013-03-18 Thread alonn
Thanks Michael for the good advice.
since I don't this chunking solution won't work for this specific use case 
(The keys would be hard to sort) would't it be an easier solution just to 
move transaction.commit() after each flush, so the DBSession.rollback() 
wouldn't lose existing data in the session?

and another thing - is there a simple update contruct? or would 
session.merge() do? 

On Monday, March 18, 2013 5:37:34 PM UTC+2, Michael Bayer wrote:

 one thing to note is that deepcopy() is not going to work.   It will copy 
 SQLAlchemy's own accounting information on the object as well and generally 
 cause confusion.

 The easiest way to insert a lot of data while detecting dupes efficiently 
 is to sort the data, then chunk through it, and for each chunk, pre-load 
 from the database all those records which reside within the range of that 
 chunk of pending data.   You put those pre-loaded records in a dictionary 
 and check it for each record.

 A simple system I use very often is (this isn't chunked, but could be):

 recs = dict(session.query(MyThing.id, MyThing))

 for i, newrec in enumerate(my_incoming_stuff):
 if newrec['id'] in recs:
 rec = recs[newrec['id']]
 rec.data = newrec['data']
 else:
 rec = MyThing(id=newrec['id'], data=newrec['data'])
 session.add(rec)

 if i % 1000 == 0:
 session.flush()

 session.commit()


 On Mar 18, 2013, at 1:54 AM, alonn alon...@gmail.com javascript: 
 wrote:

 Like all CRUD goes, I need to write some data to a table. when I write new 
 data to the table, everything works like charm. the problem starts when I 
 need to write data already existing in the table (actually updating some 
 data with the same primary key).
 the data just doesn't seem to be written to the table! I started with 
 trying to update the data with session.merge(), but later tried a more 
 brute force approach, of querying for the same primary_key in the table, 
 deleting it and the adding and flushing the changed objects.
 some where, if the basic add and flush failes the rest doesn't work.  I'll 
 be glad for a clue here.

 The code:

 def flush(obj_Instance, id):
 
 taking care of the sqlalchemy flushing
 params:
 Instance: an object Instance to flush into
 id: the unique object instance id
 

 DBSession2.add(obj_Instance)

 try:

 try:
 DBSession2.flush()
 print (flushed:, str(obj_Instance))
 except (FlushError, IntegrityError) as err:
 DBSession2.rollback()
 if ('conflicts with persistent instance' in str(err)) or 
 ('Duplicate key was ignored' in str(err)):
 transaction.begin()
 #my original slick take:
 DBSession2.merge(obj_instance) # but after it failed to 
 update correctly I changed to a more brute force approach
 #DBSession2.flush()  #to save the merge
 #from here on trying to brute force it
 #saving for further reference - another try
 newInstance = deepcopy(obj_Instance)
 print (deleting: %s % id)
 DBSession2.query(type(obj_Instance)).filter_by(ids = 
 id).delete()
 DBSession2.flush() #at this point, I was so desperate for 
 this to work I literated the code with flush commands.
 DBSession2.add(newInstance)
 DBSession2.flush()
 return
 else:
 raise #handling the case of the same key problem isn't the 
 source of conflicts

 except Exception as err:  # supposed to find out the error type and 
 message
 # the code doesn't get here, only in real exceptions it was planned to 
 catch, 3 rows in 10,000 uploaded to the db
 #TODO: make this less general and more specific
 print str(err)
 write_log(num=id, msg=some sql or sqlalchemy error use num %s as 
 id identifier with object: %s % (id, obj_Instance.name), timestamp=
 datetime.now(), errtype=sql error, log=str(err))
 DBSession2.rollback()
 transaction.begin()

 maybe this try/fail/rollback/merge or delete/insert new pattern is wrong 
 (also I think pythonic - try and ask forgiveness,but  that would be for 
 mike to judge)

 using sqlalchemy 0.7.3 vs mssql 2005 with pyodbc 2.1.11 and tg 2.1 (the 
 transaction manager comes with tg and I think is based transaction)


 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to sqlalchemy+...@googlegroups.com javascript:.
 To post to this group, send email to sqlal...@googlegroups.comjavascript:
 .
 Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.
  
  




-- 
You received this message because you are subscribed

[sqlalchemy] question about using SAVEPOINTS

2013-03-18 Thread alonn
from the 
docshttp://docs.sqlalchemy.org/en/latest/orm/session.html#using-savepoint
:

begin_nested()http://docs.sqlalchemy.org/en/latest/orm/session.html#sqlalchemy.orm.session.Session.begin_nested
 may 
be called any number of times, which will issue a new SAVEPOINT with a 
unique identifier for each call.* For each 
begin_nested()http://docs.sqlalchemy.org/en/latest/orm/session.html#sqlalchemy.orm.session.Session.begin_nested
 call, 
a corresponding 
rollback()http://docs.sqlalchemy.org/en/latest/orm/session.html#sqlalchemy.orm.session.Session.rollback
 or 
commit()http://docs.sqlalchemy.org/en/latest/orm/session.html#sqlalchemy.orm.session.Session.commit
 must 
be issued*.
Lets say I call session.begin_nested() after each successfull add something 
like:
for myModule in modules;
session.add(myModule)
session.begin_nested()
try:
session.flush()
   except:
session.rollback()
session.merge(myModule)
session.begin_nested()
transaction.commit()

my question is would a transaction.commit() suffice to commit all of the 
saved SAVEPOINTS or am I suppose to call a commit on each and everyone of 
them (as implied in the docs)

Thanks for the help

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




[sqlalchemy] Re: column_property for correlated subquery

2013-03-18 Thread alonn
If I understand the problem correctly your best shot would be using 
sqlalchemy magical `hybrid_property` , hybrid_method, etc.

here:

http://docs.sqlalchemy.org/ru/latest/orm/extensions/hybrid.html



On Monday, March 18, 2013 9:20:15 PM UTC+2, millerdev wrote:

 Hi,

 Using declarative here, and I'm trying to create a column_property with a 
 correlated subquery that returns a count of records with a matching value 
 in some other column. Here's what I've tried. Option 1 is the best, option 
 2 is ugly but second best, option 3 is not a good option since there are 
 many other classes involved and the place where I'd need to put that code 
 is far away from where it logically belongs.

 from sqlalchemy import *
 from sqlalchemy.orm import *
 from sqlalchemy.ext.declarative import *
 from sqlalchemy.ext.declarative import declared_attr

 Base = declarative_base()
 option = 1

 class Foo(Base):
 __tablename__ = 'foo'
 id = Column(Integer, primary_key=True)
 bar_id = Column(Integer, ForeignKey(bar.id))
 name = Column(String)

 if option == 1:
 # does not work (see first traceback below)
 @declared_attr
 def name_count(cls):
 clx = aliased(cls)
 return column_property(
 select(func.count([clx.id]))
 .where(clx.name == cls.name)
 .correlate(cls.__table__))

 if option == 2:
 # does not work (see second traceback below)
 _foo = aliased(Foo)
 Foo.name_count = column_property(
 select([func.count(_foo.id)])
 .where(_foo.name == Foo.name)
 .correlate(Foo.__table__))


 class Bar(Base):
 __tablename__ = 'bar'
 id = Column(Integer, primary_key=True)
 name = Column(String)


 if option == 3:
 # works, but really not where I want to put this code
 _foo = aliased(Foo)
 Foo.name_count = column_property(
 select([func.count(_foo.id)])
 .where(_foo.name == Foo.name)
 .correlate(Foo.__table__))


 Option 1 traceback:

 Traceback (most recent call last):
   File temp/example.py, line 8, in module
 class Foo(Base):
   File .../python2.7/site-packages/sqlalchemy/ext/declarative.py, line 
 1348, in __init__
 _as_declarative(cls, classname, cls.__dict__)
   File .../python2.7/site-packages/sqlalchemy/ext/declarative.py, line 
 1181, in _as_declarative
 value = getattr(cls, k)
   File .../python2.7/site-packages/sqlalchemy/ext/declarative.py, line 
 1554, in __get__
 return desc.fget(cls)
   File temp/example.py, line 15, in name_count
 clx = aliased(cls)
   File .../python2.7/site-packages/sqlalchemy/orm/util.py, line 385, in 
 aliased
 return AliasedClass(element, alias=alias, name=name, 
 adapt_on_names=adapt_on_names)
   File .../python2.7/site-packages/sqlalchemy/orm/util.py, line 298, in 
 __init__
 self.__mapper = _class_to_mapper(cls)
   File .../python2.7/site-packages/sqlalchemy/orm/util.py, line 673, in 
 _class_to_mapper
 raise exc.UnmappedClassError(class_or_mapper)
 sqlalchemy.orm.exc.UnmappedClassError: Class '__main__.Foo' is not mapped


 Option 2 traceback:

 Traceback (most recent call last):
   File temp/example.py, line 16, in module
 select([func.count(_foo.id)])
   File .../python2.7/site-packages/sqlalchemy/sql/expression.py, line 
 1229, in __call__
 return func(*c, **o)
   File .../python2.7/site-packages/sqlalchemy/sql/functions.py, line 16, 
 in __call__
 args = [_literal_as_binds(c) for c in args]
   File .../python2.7/site-packages/sqlalchemy/sql/expression.py, line 
 1440, in _literal_as_binds
 return element.__clause_element__()
   File .../python2.7/site-packages/sqlalchemy/orm/attributes.py, line 
 117, in __clause_element__
 return self.comparator.__clause_element__()
   File .../python2.7/site-packages/sqlalchemy/util/langhelpers.py, line 
 506, in oneshot
 result = self.fget(obj, *args, **kw)
   File .../python2.7/site-packages/sqlalchemy/orm/properties.py, line 
 156, in __clause_element__
 return self.adapter(self.prop.columns[0])
   File .../python2.7/site-packages/sqlalchemy/orm/util.py, line 334, in 
 __adapt_element
 return self.__adapter.traverse(elem).\
   File .../python2.7/site-packages/sqlalchemy/sql/visitors.py, line 185, 
 in traverse
 return replacement_traverse(obj, self.__traverse_options__, replace)
   File .../python2.7/site-packages/sqlalchemy/sql/visitors.py, line 281, 
 in replacement_traverse
 obj = clone(obj, **opts)
   File .../python2.7/site-packages/sqlalchemy/sql/visitors.py, line 270, 
 in clone
 newelem = replace(elem)
   File .../python2.7/site-packages/sqlalchemy/sql/visitors.py, line 182, 
 in replace
 e = v.replace(elem)
   File .../python2.7/site-packages/sqlalchemy/sql/util.py, line 720, in 
 replace
 return self._corresponding_column(col, True)
   File .../python2.7/site-packages/sqlalchemy/sql/util.py, line 695, in 
 

Re: [sqlalchemy] sanitizing sql with sqlalchemy

2013-01-01 Thread alonn
Actually I don't know what's causing the corruption but the .  looks like 
the only unvalid one in a varchar field.
since after the insert the table just stopped working (not responding to 
SELECT or DELETE) while the rest of the tables works fine

so I'm looking for something like html markupsafe library 

On Tuesday, January 1, 2013 6:19:03 PM UTC+2, werner wrote:

 On 31/12/2012 23:24, alonn wrote: 
  I'm using sqlalchemy orm (with turbogears) to write data from a web 
  application to an mssql 2005 Db (used by another application, not 
  maintained by me). 
  after dealing with a serious case of data corruption (basically 
  because of user data including the . sign). 
 Can you give more detail on how a . (point/full stop) in user data 
 corrupted your database. 

 A point is valid data in lots of situations, so should not cause you 
 problems. 

 Werner 


-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/7EszJDnNSfwJ.
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.



Re: [sqlalchemy] sanitizing sql with sqlalchemy

2013-01-01 Thread alonn
This is what I thought. that the problem is with the application and not 
the sql server. unfortunately I try to access the table directly (either 
through sqlalchemy or directly from mssql management GUI) and both fail. 
the table just doesn't respond to SELECT, DELETE, TRUNCATE etc 

On Tuesday, January 1, 2013 11:14:27 PM UTC+2, Tomas Vondra wrote:

 On 1.1.2013 21:57, Werner wrote: 
  On 01/01/2013 19:34, alonn wrote: 
  Actually I don't know what's causing the corruption but the .  looks 
  like the only unvalid one in a varchar field. 
  Why would a . in a varchar field not be valid?  Just consider 
  something like Firstname MidInitial. LastName, why would that not be 
  valid in a varchar column? 
  
  I am pretty sure that the . is not your problem. 
  
  Provide more details and hopefully someone can help you identify your 
  real problem. 

 My bet is that when OP talks about data corruption, he actually does 
 not mean that the database crashed and the data files are somehow damaged. 

 I believe the issue is that the application assummes that the varchar 
 column does not contain some characters (e.g. a dot) yet the users 
 managed to get around the application-level checks and inserted such 
 values into the database. So the data are invalid from the application 
 point of view, but the database is perfectly healthy. 

 But that's something the OP needs to explain. 

 Tomas 


-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/k5CgVbKH5nkJ.
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.



[sqlalchemy] sanitizing sql with sqlalchemy

2012-12-31 Thread alonn
I'm using sqlalchemy orm (with turbogears) to write data from a web 
application to an mssql 2005 Db (used by another application, not 
maintained by me).
after dealing with a serious case of data corruption (basically because of 
user data including the . sign). is there a way to use sqlalchemy also as 
a validator/sanitizor for userdate?
I know there is a basic sql escaping (preventing sql injection) baked into 
sqlalchemy but obviousely I need something stronger.
if sqlalchemy can't handle it by itself is there another library (or 
sqlalchemy plugin) that can give me this functionality?
thanks for the help 

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/BFcbONqoPegJ.
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.



[sqlalchemy] Re: getting results uncidoe from mssql with pyodbc (where mssql encoding is windows-1255) using turbogears scoped DBSession

2012-09-04 Thread alonn
thanks! did the trick!

On Tuesday, August 28, 2012 11:43:56 PM UTC+3, alonn wrote:

 some of my sqlalchemy 0.7.3 (with tubrogears 2.1.4) models work with a 
 mssql 2005 db using pyodbc.

 (No can't change this, don't bother suggesting, this is an enterprise 
 financial system, I can just read and write to certain tables there)

 the query returned are encoded windows-1255 instead of utf-8
 failing to return unicode causes various 'UnicodeDecodeError' error in 
 sprox and toscawidgets which I can override manualy by rewriting certain 
 lines in the sprox/tw.forms source code but not exactly an optimal solution 

 is there a  way to specify in the connection url to convert the data to 
 standard unicode encoding?

 currently using the following format:

 sqlalchemy.second.url = mssql://user:password@SERVER\db

 or maybe changing some parameter in the sqlalchemy engine should do the 
 trick?



 thanks for the help




-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/cXGSHvjP17kJ.
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.



Re: [sqlalchemy] getting results uncidoe from mssql with pyodbc (where mssql encoding is windows-1255) using turbogears scoped DBSession

2012-08-31 Thread alonn
thanks - I use pyodbc 2.1.11 with sqlalchemy 0.7.3
would upgrading one of them (or both) help me solve this? I saw in 
sqlalchemy 0.7.7 changlog :

[feature] Added interim create_engine flag
supports_unicode_binds to PyODBC dialect,
to force whether or not the dialect
passes Python unicode literals to PyODBC 
or not.

*would using that solve my problem? how and where should I call that flag?*



On Wednesday, August 29, 2012 12:55:50 AM UTC+3, Michael Bayer wrote:

 what ODBC driver ?   the encoding issues are typically configured with 
 ODBC.it's a huge difference if you're on the windows drivers, vs. 
 freetds, vs anything else.


 also I use MSSQL 2005 in production financial applications as well.


 On Aug 28, 2012, at 4:43 PM, alonn wrote:

 some of my sqlalchemy 0.7.3 (with tubrogears 2.1.4) models work with a 
 mssql 2005 db using pyodbc.

 (No can't change this, don't bother suggesting, this is an enterprise 
 financial system, I can just read and write to certain tables there)

 the query returned are encoded windows-1255 instead of utf-8
 failing to return unicode causes various 'UnicodeDecodeError' error in 
 sprox and toscawidgets which I can override manualy by rewriting certain 
 lines in the sprox/tw.forms source code but not exactly an optimal solution 

 is there a  way to specify in the connection url to convert the data to 
 standard unicode encoding?

 currently using the following format:

 sqlalchemy.second.url = mssql://user:password@SERVER\db

 or maybe changing some parameter in the sqlalchemy engine should do the 
 trick?



 thanks for the help



 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To view this discussion on the web visit 
 https://groups.google.com/d/msg/sqlalchemy/-/xTmE0yTs810J.
 To post to this group, send email to sqlal...@googlegroups.comjavascript:
 .
 To unsubscribe from this group, send email to 
 sqlalchemy+...@googlegroups.com javascript:.
 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 view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/mIe-QOn7JRgJ.
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.



Re: [sqlalchemy] getting results uncidoe from mssql with pyodbc (where mssql encoding is windows-1255) using turbogears scoped DBSession

2012-08-31 Thread alonn
I'm working on windows 7, where can I find the stack trace?

On Friday, August 31, 2012 4:53:15 PM UTC+3, Michael Bayer wrote:

 freetds or windows ?   critical 

 plus:  stack trace?   critical





 On Aug 31, 2012, at 9:28 AM, alonn wrote:

 thanks - I use pyodbc 2.1.11 with sqlalchemy 0.7.3
 would upgrading one of them (or both) help me solve this? I saw in 
 sqlalchemy 0.7.7 changlog :

 [feature] Added interim create_engine flag
 supports_unicode_binds to PyODBC dialect,
 to force whether or not the dialect
 passes Python unicode literals to PyODBC 
 or not.

 *would using that solve my problem? how and where should I call that flag?*



 On Wednesday, August 29, 2012 12:55:50 AM UTC+3, Michael Bayer wrote:

 what ODBC driver ?   the encoding issues are typically configured with 
 ODBC.it's a huge difference if you're on the windows drivers, vs. 
 freetds, vs anything else.


 also I use MSSQL 2005 in production financial applications as well.


 On Aug 28, 2012, at 4:43 PM, alonn wrote:

 some of my sqlalchemy 0.7.3 (with tubrogears 2.1.4) models work with a 
 mssql 2005 db using pyodbc.

 (No can't change this, don't bother suggesting, this is an enterprise 
 financial system, I can just read and write to certain tables there)

 the query returned are encoded windows-1255 instead of utf-8
 failing to return unicode causes various 'UnicodeDecodeError' error in 
 sprox and toscawidgets which I can override manualy by rewriting certain 
 lines in the sprox/tw.forms source code but not exactly an optimal solution 

 is there a  way to specify in the connection url to convert the data to 
 standard unicode encoding?

 currently using the following format:

 sqlalchemy.second.url = mssql://user:password@SERVER\db

 or maybe changing some parameter in the sqlalchemy engine should do the 
 trick?



 thanks for the help



 -- 
 You received this message because you are subscribed to the Google Groups 
 sqlalchemy group.
 To view this discussion on the web visit 
 https://groups.google.com/d/msg/sqlalchemy/-/xTmE0yTs810J.
 To post to this group, send email to sqlal...@googlegroups.com.
 To unsubscribe from this group, send email to 
 sqlalchemy+...@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 view this discussion on the web visit 
 https://groups.google.com/d/msg/sqlalchemy/-/mIe-QOn7JRgJ.
 To post to this group, send email to sqlal...@googlegroups.comjavascript:
 .
 To unsubscribe from this group, send email to 
 sqlalchemy+...@googlegroups.com javascript:.
 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 view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/wwRZkYf0dFEJ.
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.



[sqlalchemy] getting results uncidoe from mssql with pyodbc (where mssql encoding is windows-1255) using turbogears scoped DBSession

2012-08-28 Thread alonn
some of my sqlalchemy 0.7.3 (with tubrogears 2.1.4) models work with a 
mssql 2005 db using pyodbc.

(No can't change this, don't bother suggesting, this is an enterprise 
financial system, I can just read and write to certain tables there)

the query returned are encoded windows-1255 instead of utf-8
failing to return unicode causes various 'UnicodeDecodeError' error in 
sprox and toscawidgets which I can override manualy by rewriting certain 
lines in the sprox/tw.forms source code but not exactly an optimal solution 

is there a  way to specify in the connection url to convert the data to 
standard unicode encoding?

currently using the following format:

sqlalchemy.second.url = mssql://user:password@SERVER\db

or maybe changing some parameter in the sqlalchemy engine should do the 
trick?



thanks for the help


-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/xTmE0yTs810J.
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.



[sqlalchemy] strange attributeerror module object has no attribute exc when using sqlalchemy from a mod_wsgi handle

2012-03-27 Thread alonn
this is what I got from tailing the mod_wsgi error stack:

[Tue Mar 27 23:14:16 2012] [error] [client 127.0.0.1] from sqlalchemy 
import create_engine,String,Unicode,Integer, Column, func,distinct, desc
[Tue Mar 27 23:14:16 2012] [error] [client 127.0.0.1]   File 
/path/to/virtualenv/app/data/virtenv/lib/python2.6/site-packages/sqlalchemy/__init__.py,
 
line 10, in module
[Tue Mar 27 23:35:50 2012] [error] [client 127.0.0.1] AttributeError: 
'module' object has no attribute 'exc'

actually when I run the file directly from python without mod_wsgi the 
error doesn' t show up.. strange

I'll be glas any help/exprience  with this strange problem? 

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/_kN4u5tgkXwJ.
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.



[sqlalchemy] using sqlalchemy with Google app engine

2012-02-08 Thread alonn
I'm trying to deploy an sqlalchemy+ bottle.py web app to google app
engine. I saw they also have an sql like backend so I guess sqlalchemy
could work with Gae but I'm not sure
would It support sqlalchemy from the box? or how should I the
application it if needed?
I know this was asked before, but the last time a couple of month ago,
there wasn't a clear answer about that

-- 
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.