[sqlalchemy] Query representation

2008-10-06 Thread Joril
Hi everyone! I'm looking for a way to log queries at a higher level than SQL.. That is, given the class Base = declarative_base() class DataTest(Base): id = Column(Integer, primary_key = True) propb = Column(Boolean) __tablename__ = t right now when I try to print a query

[sqlalchemy] MSSQL Failing deletes with subquery + schema

2008-10-06 Thread Paul Johnston
Hi, Is there any chance someone can look at ticket 973? http://www.sqlalchemy.org/trac/ticket/973 This is quite important to me, hitting the bug with a production app. I've got a very hacky fix, which just disables the table aliasing, but I don't think that's good enough to commit. I have

[sqlalchemy] Re: Consideration using data model with Sqlalchemy

2008-10-06 Thread az
i'm answering the arhitectural part of your question. pylons is around MVC (model view controller) approach. u have squezeed model into the controller which isnt _bad as such but not appropriate for any complexier/larger modelling. controllers are about translating between model and view,

[sqlalchemy] Data logging

2008-10-06 Thread Joril
Hi everyone! I'm trying to implement data logging with SQLAlchemy.. That is, whenever someone updates a persisted entity, generate a new record and then mark the old one as such. My problem right now is that if I load an entity from the DBMS, modify it and then try to save it again, I have to

[sqlalchemy] Re: MSSQL Failing deletes with subquery + schema

2008-10-06 Thread Empty
Hi Is there any chance someone can look at ticket 973? http://www.sqlalchemy.org/trac/ticket/973 This is quite important to me, hitting the bug with a production app. I've got a very hacky fix, which just disables the table aliasing, but I don't think that's good enough to commit. I have

[sqlalchemy] Re: Consideration using data model with Sqlalchemy

2008-10-06 Thread Michael Bayer
I'm curious why a special twisted server is needed to calculate things that should live very naturally within the relational database, i.e. votes, user stats, etc. If calculating these things via SQL is time consuming, those stats can be calculated on a periodic basis (either upon change in

[sqlalchemy] Re: Data logging

2008-10-06 Thread Michael Bayer
the cleanest way is to leave the old entity alone and to create a new one using a copy constructor: class MyEntity(object): def new_version(self): return MyEntity(version = self.version + 1, foo=self.foo, bar=self.bar) To force an object from an UPDATE back to an INSERT, which is

[sqlalchemy] Re: Query representation

2008-10-06 Thread Michael Bayer
On Oct 6, 4:14 am, Joril [EMAIL PROTECTED] wrote: Hi everyone! I'm looking for a way to log queries at a higher level than SQL.. That is, given the class Base = declarative_base() class DataTest(Base):     id = Column(Integer, primary_key = True)     propb = Column(Boolean)    

[sqlalchemy] Re: Data logging

2008-10-06 Thread Joril
Perfect! Thanks again! --~--~-~--~~~---~--~~ 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

[sqlalchemy] inhirit columnnames from another class

2008-10-06 Thread JASH
Hi ! I am a huge fan of declerative base but now I run into a problem... Say I have a class that stores files in a database: Base = decclarative_base() class Document(Base): Id = Column(Integer, primary_key=True) Filename = Column(String(255), Unique =

[sqlalchemy] Re: inhirit columnnames from another class

2008-10-06 Thread Michael Bayer
not sure if this is what youre asking but it sounds like this: http://groups.google.com/group/sqlalchemy/browse_thread/thread/5c629ce3e27916c7# On Oct 6, 11:02 am, JASH [EMAIL PROTECTED] wrote: Hi ! I am a huge fan of declerative base but now I run into a problem... Say I have a class

[sqlalchemy] Re: inhirit columnnames from another class

2008-10-06 Thread Martijn Moeling
I accedently posted the message premature, an was in the process of completing it. The answer seems suitable.. Thanks!! -Oorspronkelijk bericht- Van: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] Namens Michael Bayer Verzonden: Monday, October 06, 2008 5:19 PM Aan: sqlalchemy

[sqlalchemy] Re: MSSQL Failing deletes with subquery + schema

2008-10-06 Thread Michael Bayer
I made some comments on the ticket. Also GG is not delivering email for me today... --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: Query representation

2008-10-06 Thread Joril
On 6 Ott, 16:26, Michael Bayer [EMAIL PROTECTED] wrote: Alternatively you could visit and compile the clause directly with your own compiler, which subclasses compiler.DefaultCompiler and overrides visit_bindparam() to return a string representation of the data instead of a param name. I

[sqlalchemy] concurrency issues?

2008-10-06 Thread coder_gus
Hi, I am writing an application server using twisted and sqlalchemy. On the server - database relation I use a pool of threads each with its own database connection, session etc. The problem is that I have 2 tables (one with products and one with events that might happen to a product) and I

[sqlalchemy] Re: problems with quoted Columnnames

2008-10-06 Thread Michael Bayer
test case: from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import DeclarativeMeta, declarative_base class DavBaseClass(DeclarativeMeta): def __init__(self,ClassName,Bases,dict_): dict_['displayname']= Column(Unicode(255),quote=True)

[sqlalchemy] Re: concurrency issues?

2008-10-06 Thread Michael Bayer
you might want to use a SELECTFOR UPDATE so that the selected rows are locked for the duration of that transaction. On Oct 6, 2:19 pm, coder_gus [EMAIL PROTECTED] wrote: Hi, I am writing an application server using twisted and sqlalchemy. On the server - database relation I use a pool of

[sqlalchemy] Mirroring attributes via the mapper

2008-10-06 Thread Sam Magister
Hi, I'm using 0.5rc1. I have a Employee class which I map to an employee table. The primary key column is called 'employee_id' for some reasons having to do with joined table inheritance. Depending on the application, I want to be able to refer a .employee_id or .id attribute of the Employee

[sqlalchemy] Re: concurrency issues?

2008-10-06 Thread Kyle Schaffrick
On Mon, 6 Oct 2008 11:24:00 -0700 (PDT) Michael Bayer [EMAIL PROTECTED] wrote: On Oct 6, 2:19 pm, coder_gus [EMAIL PROTECTED] wrote: Hi, I am writing an application server using twisted and sqlalchemy. On the server - database relation I use a pool of threads each with its own

[sqlalchemy] Re: Mirroring attributes via the mapper

2008-10-06 Thread Michael Bayer
the ambiguity there is what if you set id to one thing and employee_id to another. I think one would win and the other not. I usually do what you have there with a synonym which is designed for this: mapper(Employee, table, properties={'id':synonym('employee_id')})

[sqlalchemy] add_entity(y) and join(y)

2008-10-06 Thread az
hi i have a query where q = ...q.initial q = q.join( some_link_name ) ...q.otherstuff q = q.add_entity( target_klas_of_the_above_link) ... this used to work ok, but recently it went doing cartesian products because the join made itself an alias. i made it into: q = ...q.initial q =

[sqlalchemy] Re: filter Association and order the union via Orm?

2008-10-06 Thread Marco De Felice
Michael Bayer wrote: the most straightforward way is to have Parent/Child descend from a common base class and use concrete table inheritance in conjunction with polymorphic_union, as described in :

[sqlalchemy] Re: concurrency issues?

2008-10-06 Thread coder_gus
Yes, I understand, thank you for your answer. I was hoping that I could find something more pythonic to do the table locking - I know that it isn't quite portable and that's why there isn't something more code oriented, but I didn't want to get to issue a LOCK table for this. Thanks. Kyle

[sqlalchemy] Re: filter Association and order the union via Orm?

2008-10-06 Thread Michael Bayer
On Oct 6, 4:11 pm, Marco De Felice [EMAIL PROTECTED] wrote: Michael Bayer wrote: the most straightforward way is to have Parent/Child descend from a   common base class and use concrete table inheritance in conjunction   with polymorphic_union, as described in :  

[sqlalchemy] Re: add_entity(y) and join(y)

2008-10-06 Thread Michael Bayer
On Oct 6, 4:22 pm, [EMAIL PROTECTED] wrote: hi i have a query where q = ...q.initial q = q.join( some_link_name ) ...q.otherstuff q = q.add_entity( target_klas_of_the_above_link) ... this used to work ok, but recently it went doing cartesian products because the join made itself an

[sqlalchemy] Re: problems with quoted Columnnames

2008-10-06 Thread Martijn Moeling
I have been investigating some more and solved the issue by changing the unbound Unicode to UnicodeText I am using SA 0.5r1 and mysql 5.x the unbound Unicode worked with 0.4, I had to upgrade to 0.5 for some other stuff I used and this confused me. Nevertheless the Fields defined in the

[sqlalchemy] Re: problems with quoted Columnnames

2008-10-06 Thread Michael Bayer
try attaching a fully reproducing test case, since the one I created seems to work. On Oct 6, 6:45 pm, Martijn Moeling [EMAIL PROTECTED] wrote: I have been investigating some more and solved the issue by changing the unbound Unicode to UnicodeText I am using SA 0.5r1 and mysql 5.x the

[sqlalchemy] Re: Two foreignkey's to the same table, rendering a join error.

2008-10-06 Thread Jorge Vargas
On Sun, Oct 5, 2008 at 8:56 AM, Michael Bayer [EMAIL PROTECTED] wrote: you can use strings with Python in them when you use declarative even with args like primaryjoin, so you could say things like: class Policy(DeclarativeBase): __tablename__ = 'policy' policy_state =