[sqlalchemy] sqlalchemy.org down?
I can't reach www.sqlalchemy.org, anyone else having problems? Arnar --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Latests unicode changes breaking MSSQL
Theres a hook I added for supports_unicode_statements() on Dialect that will tell the engine to stringify the queries before being sent.Oracle implements one that returns False, for example. just add one in and have it return false. but, I thought MS-SQL supports unicode column names ? hows that going to work ? On Mar 28, 2007, at 10:49 PM, Rick Morrison wrote: Mike, I'm seeing som breaking of MSSQL / pymssql that I think might be caused by the latest unicode stuff. The statements themselves are beginning to be issued in unicode when a query is constructed in the ORM. Where is an appropriate place for the dialect to intercept the call to the DB-API just before it's issued so that it can convert to str ()? I've tried do_execute and _execute so far. Rick --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: sqlalchemy.org down?
On 3/29/07, Michael Bayer [EMAIL PROTECTED] wrote: rebooting hopefully it comes up Works for me, thanks. Arnar --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Connection handling, re-establishing connections?
On 3/25/07, Michael Bayer [EMAIL PROTECTED] wrote: Still, all of these measures require that we actually get an error thrown to detect that a restart took place, which inconveniently usually happens not at the point of cursor() but at the point of execute(), and we dont have any frameworks in place (nor am i terribly comfortable with) to handle error was thrown, reconnect and try execute() again. lots of things can go wrong with that, namely transactional state getting lost, mis-interpreted errors resulting in double-executions, race conditions, etc. so i dont know if theres a way to recover from DB restarts 100% seamlessly. I agree, trying to make it seamless is a waste of time. I'd just like to see it be able to re-connect and work again on new queries, eventually. I'll have a look at the ticket but the Fairies intimidate me. :) -Jonathan --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Sqlalchemy with ORM difficulties
Guys, I am having some difficulties in the following code. I skipped a few lines but basically I think the logic is very clear. In the line u.save() it produce the error which is pasted in part 2. I found that the self object under save method is different than the original one that i created by u = BRUser(). May I ask if anyone here will have any suggestion? Thank you. Riddler Part 1 --- from sqlalchemy import * from sqlalchemy.orm import * dbengine = create_engine('postgres://riddler:[EMAIL PROTECTED]:5432/ riddler') metadata = MetaData() metadata.create_all(dbengine) class BRUser(object): isRecordExist = False @classmethod def save(self): session = create_session() session.save(self) DBObj.session.flush() self.isRecordExist = True BRUser_table = Table('bruser', metadata, Column('user_id', Integer, primary_key=True), Column('username', String(50)) ) mapper(BRUser, BRUser_table, properties = { 'userID': BRUser_table.c.user_id, 'username': BRUser_table.c.username }) u = BRUser() u.username = riddler u.save() -- Part 2 --- sqlalchemy.exceptions.InvalidRequestError: Class 'type' entity name 'None' has no mapper associated with it --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: Sqlalchemy with ORM difficulties
save() should not be a @classmethod. also consider using the assignmapper extension which I think accomplishes what youre looking for. On Mar 29, 2007, at 2:35 PM, Riddler wrote: Guys, I am having some difficulties in the following code. I skipped a few lines but basically I think the logic is very clear. In the line u.save() it produce the error which is pasted in part 2. I found that the self object under save method is different than the original one that i created by u = BRUser(). May I ask if anyone here will have any suggestion? Thank you. Riddler Part 1 --- from sqlalchemy import * from sqlalchemy.orm import * dbengine = create_engine('postgres://riddler:[EMAIL PROTECTED]:5432/ riddler') metadata = MetaData() metadata.create_all(dbengine) class BRUser(object): isRecordExist = False @classmethod def save(self): session = create_session() session.save(self) DBObj.session.flush() self.isRecordExist = True BRUser_table = Table('bruser', metadata, Column('user_id', Integer, primary_key=True), Column('username', String(50)) ) mapper(BRUser, BRUser_table, properties = { 'userID': BRUser_table.c.user_id, 'username': BRUser_table.c.username }) u = BRUser() u.username = riddler u.save() -- Part 2 --- sqlalchemy.exceptions.InvalidRequestError: Class 'type' entity name 'None' has no mapper associated with it --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] before_insert in mapper extension
If a mapper extension modifies an attribute of an instance (the same instance being saved) in a before_insert() or before_update() call, are those attributes tracked as changed so they'll be included in the update? If not, is there any way to mark those items as changed? Thanks, Rick --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: before_insert in mapper extension
theyre tracked as changed but the unit of work has already figured out the full list of elements it wants to save (remember that it has alraedy built up the full order of operations using a dependency sort). if you want to affect the list of elements to be saved you might want to do that prior to the flush() (you can also subclass Session to just decorate the flush() procedure). alternatively you could attempt to call the save_obj() method directly on the desired mapper, that would be a little more adventurous (particularly if youre not sure if your additional objects may have already been saved in that flush, leading to double operations). if neither of the above work we could attempt to stick a hook in there somehow at the point at which UOW is figuring out what should be saved. On Mar 29, 2007, at 3:02 PM, Rick Morrison wrote: If a mapper extension modifies an attribute of an instance (the same instance being saved) in a before_insert() or before_update() call, are those attributes tracked as changed so they'll be included in the update? If not, is there any way to mark those items as changed? Thanks, Rick --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: before_insert in mapper extension
On Mar 29, 2007, at 5:43 PM, Rick Morrison wrote: Thanks. Does that full list of elements include individual instance attributes or just instances? we're talking about session.dirty and stuff like that, its instances. What happens if the before_update of an instance, the handler modifies a column on that same instance that is being saved? Is that also tracked via UOW, or via a compare against saved original values? if you change something on the instance in before_update, if its a column-level attribute then whatever value you just set it to is what will get updated into the DB. the UOW doesnt care about changes at that point its already assembled all the objects and is sending them off to get persisted. then the flush finishes, and whatever state on the instances, including whatever you wanted to set, gets committed and the in-memory history of what they were previously is erased. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---