Conor,
Thanks for your help!
On Tue, Oct 20, 2009 at 16:27, Conor conor.edward.da...@gmail.com wrote:
You can tell SQLAlchemy that the database will cascade deletes on its
own (add passive_deletes=True to the relation arguments, see
I have three related tables in MySQL and a corresponding mappings in
SQLAlchemy.
It all works fine until I tried to delete objects. I tinkered with
different options but couldn't get it to work.
Here is the relevant mappings:
mapper(PlanetEntry, community_planet_tbl, properties={
I'm trying to express the following SQL:
SELECT * FROM attendances a WHERE grade = (SELECT MAX(grade) FROM
attendances WHERE student_id=a.student_id) and school_id=112;
A2 = aliased(A) # A is Attendance class
q2 = s.query(max_grade).filter(A.student_id==A2.student_id).subquery()
print q2 #
On 12 май, 10:17, Max Ischenko ische...@gmail.com wrote:
I'm trying to express the following SQL:
SELECT * FROM attendances a WHERE grade = (SELECT MAX(grade) FROM
attendances WHERE student_id=a.student_id) and school_id=112;
I've got it working using literal SQL but there must
On Tue, May 12, 2009 at 11:43, a...@svilendobrev.com wrote:
try label the column in q2, say q2.maxgrade, then use that as
print s.query(A).filter( A.grade==q2.maxgrade)...
Doesn't work:
q2 =
s.query(max_grade.label('maxgrade')).filter(A.student_id==A2.student_id).subquery()
print
On Sun, Apr 12, 2009 at 19:21, Michael Bayer mike...@zzzcomputing.comwrote:
use a seperate join() call for each path. join(path1, path2, path3 ...)
assumes thats one path along related entities.
Thanks! Just in case anyone interested, here is final (working) code:
clauses = []
Hi,
SQLAlchemy magic is needed!
I have users table plus two many-to-many relations (skills and cities).
I'm trying to implement a search on one or two of these relations.
It works fine if I join with skills OR cities but it gives weird error when
I'm trying to join both.
I suspect my .join()
On 13 фев, 18:46, a...@svilendobrev.com wrote:
i guess s.execute(stmt, params=dict(codeword=codeword) )
It worked, thanks a lot!
Strangely though params= not mentioned on this page:
http://www.sqlalchemy.org/docs/05/sqlexpression.html
Max.
Hi,
I do a simple query and got very strange error:
File '/home/max/projects/site-baseline/doupy/doupy/controllers/
salarydb.py', line 432 in record
c.user = s.query(WordpressUser).get(c.rec.user_id)
File '/home/max/projects/site-baseline/py/lib/python2.5/site-packages/
I get an error when I'm trying tu run this:
stmt = text(select * from salary_data_new
where codeword=:codeword union
select * from salary_data_clean where codeword=:codeword
)
# s is instance of Session() class factory
Just a follow up to let you know SA 0.5 now runs smoothly on my site.
Actually, it has been running for about a week now.
Onto your comments:
I didn't use get_session() but I did use session.mapper instead of normal
orm.mapper class.
The reason for this is here http://tinyurl.com/2a76hp - I was
Hello,
I'm having trouble doing insertmany correctly. I read the docs and
came up with this code:
s = Session()
ins = data_tbl.insert()
records = []
for rec in s.execute(sql).fetchall():
records.append(rec)
ins.execute(records)
It gives an
On 5 май, 11:55, Max Ischenko [EMAIL PROTECTED] wrote:
Hello,
My python app uses Wordpress blog database and my sqlalchemy mappings
recently broke due to Wordpress update. Can someone pls help to map
the following taxonomy tables into SA?
I've tried to follow Specifying Alternate Join
On 5/6/08, Michael Bayer [EMAIL PROTECTED] wrote:
mapper(WordpressPost, wp_posts_tbl, properties={
'categories': relation(WordpressTaxonomy, primaryjoin=
and_(wp_terms_taxonomy_tbl.c.taxonomy=='category',
wp_term_relationships_tbl
Hello,
My python app uses Wordpress blog database and my sqlalchemy mappings
recently broke due to Wordpress update. Can someone pls help to map
the following taxonomy tables into SA?
http://codex.wordpress.org/WordPress_Taxonomy
I kind of stuck with
sqlalchemy.exceptions.ArgumentError: Error
Hello,
I'm struggling with a simple one to many relation, pls help!
active_meetup = MeetupEvent(...)
reg = MeetupRegistration(meeting=active_meetup)
db.save(reg)
*class 'sqlalchemy.exceptions.OperationalError': (OperationalError) (1048,
Column 'meeting_id' cannot be null) u'INSERT INTO
On 29 янв, 10:47, Alexandre Conrad [EMAIL PROTECTED] wrote:
Hello Max,
AFAIR, I've had similar problems latelty when having a table with
composite primary keys and running SQLite. I think Mike told me SQLite
didn't support that. I'm no SQLite user, but I had this problem when I
had to
On Jan 29, 2008 3:46 PM, jason kirtland [EMAIL PROTECTED] wrote:
The mapped backref is 'meetup' but the class's __init__ is setting
'meeting':
Duh!
Thanks a lot.
Max.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
I had a Session.configure() statement which was called for both sessions and
this was making setup unusable. Duh.
On Jan 16, 2008 2:12 PM, Max Ischenko [EMAIL PROTECTED] wrote:
On Jan 15, 2008 6:14 PM, Michael Bayer [EMAIL PROTECTED] wrote:
if you are using multiple scoped sessions you
On Jan 15, 2008 6:14 PM, Michael Bayer [EMAIL PROTECTED] wrote:
if you are using multiple scoped sessions you won't be able to use
Session.mapper - the idea of Session.mapper is that all instances get
tied to a single contextual session.
OK, so how do I set it up. I'm reading
Hello,
Sorry for reply to myself; just want to tell that the problem is solved.
Here is how my setup looks like:
Session = scoped_session(sessionmaker(autoflush=True, transactional=False))
SessionCDB = scoped_session(sessionmaker(autoflush=True,
transactional=False))
...
# application
Hello Paul,
On 8 янв, 17:07, Paul Johnston [EMAIL PROTECTED] wrote:
Not 100% sure without seeing your model, but you probably want to use
session.mapper in place of mapper.
That was it, thanks a lot!
Max.
--~--~-~--~~~---~--~~
You received this message
Hello,
My migration to 0.4 didn't end well since now I sometimes get the following
error:
sqlalchemy.exceptions.InvalidRequestError: Parent instance class '
doupy.model.objects.JobPosting' is not bound to a Session, and no
contextual session is established; lazy load operation of attribute
Hello Michael,
Thanks for your enlightening comments, pls see my comments below.
On 12/29/07, Michael Bayer [EMAIL PROTECTED] wrote:
the transaction commit inside the create_draft method is a little
strange. usually, if you have a long running transaction, there would
be a begin()/commit()
Hello,
I am porting my code to SA 0.4 and cannot figure out whether or not I should
work correctly.
I have most of my db-related code united under a single DatabaseFacade class
which is then bound to SA session via property:
class DatabaseFacade(object):
...
session =
On 28 дек, 11:20, Max Ischenko [EMAIL PROTECTED] wrote:
Another error I am now getting is:
InvalidRequestError: Instance '[EMAIL PROTECTED]' is with key (class '
doupy.model.objects.Invoice', (73L,), None) already persisted with a
different identity
Any ideas how to fix this?
Method
Hello Bertrand,
It works like a charm, thanks a lot.
Max.
On 12/27/07, Bertrand Croq [EMAIL PROTECTED] wrote:
JobPosting's mapper tells RefdataLocation's mapper to add a property
named 'vacancies', then you tell RefdataLocation's mapper to add a
property
named 'vacancies'.
Replace these
Hello,
I'm using SQLAlchemy to access my WordPress database and I need to
query posts from particular category.
There is a many-to-many mapping between wp_posts and wp_categories
table, throught wp_post2cat table.
I was able to come up with the following code:
cats =
Hello,
After recent upgrade of my Pylons app I have been seeing the errors
like this one:
sqlalchemy.exceptions.SQLError: (UnicodeDecodeError)
'utf8' codec can't decode byte 0x96 in position 718: unexpected
code byte u'SELECT jobad_posts.post_status AS
jobad_posts_post_status,
Hi,
If I have two tables related via foreign key how can I tell SA that
accessing foreign key should fetch related object automatically? By
default it simply gives me the FK as integer which is not what I want.
Here are my mappers:
wp_users_tbl = Table('wp_users', meta, autoload=True)
Hello,
On May 10, 4:38 pm, King Simon-NFHD78 [EMAIL PROTECTED]
wrote:
You're halfway there with your 'posts' relation. I think if you pass
backref='author' in your relation, then WordpressPost objects will get
an 'author' property which points back to the WordpressUser.
Nope, it doesn't
Hi,
On 5/10/07, King Simon-NFHD78 [EMAIL PROTECTED] wrote:
Nope, it doesn't work. At least, I can't get it to work.
If I use backref='author' new attribute 'author' appears but equals
None even though the author_id is something like 123.
You're not getting caught by this, are you:
Hello,
I'm struggling to setup SA/Pylons for a multidatabase env without much
luck.
As far as I understand, I need a session per database. In Pylons, I get
it for free via session_context binding. In other words, I have setup
a session_context object for each of the database I need to work
33 matches
Mail list logo