[sqlalchemy] Re: backref/back_populates question

2011-08-15 Thread cd34
On Aug 15, 1:05 am, Michael Bayer mike...@zzzcomputing.com wrote: A relationship() can be added at any time to any mapped class - when using declarative config, just assigning it to the class is all that's needed, mapper.add_property() is called as a result.     Using backref where you had

[sqlalchemy] backref/back_populates question

2011-08-14 Thread cd34
I'm writing a package for Pyramid which has a base AuthUser declaration. I want to allow users that have installed the package the ability to extend the AuthUserProfile so that the Mako templates can be accessed with my subscriber which populates user. with the AuthUser properties. Currently, it

[sqlalchemy] Re: backref/back_populates question

2011-08-14 Thread cd34
easy_install (for Pyramid), then, allow the user to extend the class locally. So, the person installs my package, but, needs to be able to extend user_profile themselves. https://github.com/cd34/pyramid_apex/blob/master/pyramid_apex/views.py The issue I'm running into currently is that in the model

[sqlalchemy] Re: Passing runtime value to relationship join condition

2011-02-12 Thread cd34
uid was the logged in user's id. I didn't grasp the bindparam/ eagerload dependency and almost had that solution working. That wiki page clarified it. As always, thank you for the quick response. -- You received this message because you are subscribed to the Google Groups sqlalchemy group.

[sqlalchemy] Passing runtime value to relationship join condition

2011-02-11 Thread cd34
I'm trying to pass a value to a relation at runtime rather than instantiation time. I've got the callable working with a fixed value, but, in reading the docs over the last few days , I'm either not finding the proper incantation or the right terms in the documentation to figure out what I'm

[sqlalchemy] Re: Association Table query against child in many to many relationship from Parent

2010-09-26 Thread cd34
By forcing my join, it appears that I can get it to do what I wanted. After thinking a bit about the ORM, doing what I wanted 'magically' would have been quite a feat. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send

[sqlalchemy] Re: Pulling objects out of SQLAlchemy object

2010-09-19 Thread cd34
On Sep 19, 12:36 pm, Michael Bayer mike...@zzzcomputing.com wrote: If I reference order_by=Block_element.sorttree, paster crashes with the same error. order_by='somestr' with declarative means the string is a Python eval.  So if you wanted to put the name of the Table here, its

[sqlalchemy] Pulling objects out of SQLAlchemy object

2010-09-18 Thread cd34
I've tried to pull out as much cruft and redesign to get the bare minimum model to make it easier to use the collection_class. What I'm trying to do: page.template.blocks[0].elements[0] as page.template['content'].elements[0] Right now, I get: page.template.blocks[0].name = 'content'

[sqlalchemy] Re: Pulling objects out of SQLAlchemy object

2010-09-18 Thread cd34
Renamed the association_proxy now that I understand how it works and what I was doing wrong. I ended up with model/cms.py: class Template(Base): __tablename__ = 'm_template' id = Column(mysql.BIGINT(20, unsigned=True), primary_key=True, autoincrement=True) name =

[sqlalchemy] Re: Relationship where relation is set by condition not present in table

2010-09-02 Thread cd34
meta.Session.query(Job).order_by(Job.min_level).order_by(Job.descr).filter(Job.tier==1).outerjoin((User_job_progress, User_job_progress.job_id==Job.job_id)).filter(User_job_progress.fb_uid==1) results in a query of: FROM xxx_jobs LEFT OUTER JOIN xxx_user_job_progress ON

[sqlalchemy] Re: Relationship where relation is set by condition not present in table

2010-09-02 Thread cd34
Just not having a lot of luck here. :) meta.Session.query(Job).order_by(Job.min_level).order_by(Job.descr).filter(Job.tier==1).outerjoin((User_job_progress, and_(User_job_progress.job_id==Job.job_id, User_job_progress.fb_uid==1))).all() results in: SELECT xxx_jobs.job_id AS xxx_jobs_job_id,

[sqlalchemy] Re: Relationship where relation is set by condition not present in table

2010-09-02 Thread cd34
% for job,progress in tmpl_context.jobs: error on my part after the outerjoin. Thanks for the pointers in the right direction. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To

[sqlalchemy] Relationship where relation is set by condition not present in table

2010-08-31 Thread cd34
I have 4 tables: users, jobs, job_items, job_progress class User(Base): __tablename__ = 'xxx_users' fb_uid = Column(mysql.MSBigInteger(20, unsigned=True), primary_key=True) class Job(Base): __tablename__ = 'xxx_jobs' job_id = Column(mysql.MSBigInteger(20, unsigned = True),

[sqlalchemy] Re: Relationship where relation is set by condition not present in table

2010-08-31 Thread cd34
That's what I thought about 10 minutes after posting. I thought there might be a trick in the DeclarativeBase declaration that I missed. Thanks for the quick reply. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email

[sqlalchemy] Re: Pulling objects out of SQLAlchemy object

2010-07-04 Thread cd34
I've run into a minor stumbling block. My metadata table is set up as a relationship rather than Base.metadata. Since I needed to expose sorttree which would attached to the Base.metadata record, I was unsure how to modify that record using normal methods. I'm thinking that I might be able to

[sqlalchemy] Pulling objects out of SQLAlchemy object

2010-07-03 Thread cd34
I have a Declarative Base model that is laid out like: content - page - block block block block is a meta that points to a block table and a further object of element. page is a many to many to block placement, but, is a one to one to

[sqlalchemy] relation to table to original table

2010-06-06 Thread cd34
I've got a schema that I was having problems with last night. I got it working, but, it seems somewhat dangerous unless I force lazy loading: class User(Base): __tablename__ = 'xxx_users' fb_uid = Column(mysql.MSBigInteger(20, unsigned=True), primary_key=True) friends =

[sqlalchemy] Re: relation to table to original table

2010-06-06 Thread cd34
as I stumble across join_depth :) Had I just waited another five minutes to post. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to

[sqlalchemy] Re: Directly saving a dictionary of column values to SA...

2009-10-30 Thread cd34
On Oct 30, 4:44 am, Shane shane.luttr...@gmail.com wrote: I am using SA within TurboGears.  When saving data from form fields, I often have a dict of key/value pairs (where values is always a string and must by correctly typed) where each key is set up to correspond to a column within the SA

[sqlalchemy] Re: Directly saving a dictionary of column values to SA...

2009-10-30 Thread cd34
On Oct 31, 12:00 am, cd34 mcd...@gmail.com wrote: On Oct 30, 4:44 am, Shane shane.luttr...@gmail.com wrote: I am using SA within TurboGears.  When saving data from form fields, I often have a dict of key/value pairs (where values is always a string and must by correctly typed) where each

[sqlalchemy] Re: web development with sqlalchemy

2009-10-21 Thread cd34
On Oct 21, 11:09 am, webdexter webdex...@gmail.com wrote: I have to develop an web interface for a database created by sqlAlchemy. First I was thinking using django but after few days I am thinking that using SA and django, moreover on an already existing project, is not a good idea because

[sqlalchemy] Re: invalid transaction rollback etc and making a join join

2009-10-17 Thread cd34
On Oct 17, 6:49 pm, Jeff Cook cookieca...@gmail.com wrote: Unfortunately, from a support-seeker point of view, such rhetoric is often necessary. How many times have you written a mailing list or hit sqlalchemy.pool_recycle = 10 I had odd issues -- even though mysql was set to |

[sqlalchemy] Do the columns in 'foreign_keys' represent only the 'foreign' columns in this join condition ?

2009-10-16 Thread cd34
I'm using SQLAlchemy 0.5.6, Python 2.5.4, Debian Linux I have a defined schema but am experimenting with a different way to display the data. While I have gotten a portion of this working, I am stuck putting the second condition into the primaryjoin. Classes have been clipped for brevity.

[sqlalchemy] Re: Do the columns in 'foreign_keys' represent only the 'foreign' columns in this join condition ?

2009-10-16 Thread cd34
On Oct 17, 1:36 am, Michael Bayer mike...@zzzcomputing.com wrote: At the moment you have an and_() of two string expressions, which   SQLalchemy knows nothing about and therefore cannot apply mapping   logic to it.   When using declarative, you do have the option to quote   the expression