[sqlalchemy] Re: setting table and mapper arguments with Declarative

2008-09-23 Thread GHZ
On Sep 18, 2:59 pm, Michael Bayer [EMAIL PROTECTED] wrote: Well, I would think __table_args__ is the only argument you'd really   want to propigate in that way, and this is an inconvenience I've also   had so perhaps we'll do something about it...I would propose a   default_table_args keyword

[sqlalchemy] Re: Queries very slow for parsing Wikipedia dump -- any ideas for speeding it up?

2008-09-23 Thread az
this is general programming approach, not sql specific. for a 7 mil objects... u have to try to do some vertical (wrong term probably) layer-splitting of the data. imagine the objects being rectangles on horizontal line, each containg same layers. now u walk the rectangles like for each in X:

[sqlalchemy] Problems with join query, can't figure out what's wrong. Noob alert!

2008-09-23 Thread olavgg
I've recently started using SQLAlchemy and is a newb. I have good SQL knowledge though. My first project with SQLAlchemy is a big project where I integrate SQLAlchemy to a Plone application. So far it has been working great for queries from a single table however queries with joins in two or more

[sqlalchemy] Re: Queries very slow for parsing Wikipedia dump -- any ideas for speeding it up?

2008-09-23 Thread Shawn Church
Just a couple thoughts that might help you out: 1) I would profile the code. It seems to me that running a regular expression on an entire wikipedia article would be a VERY expensive operation. 2) Did the first pass succeed and how long did it take? 3) Taking a quick look at

[sqlalchemy] Re: cascades over many-to-many

2008-09-23 Thread Michael Bayer
On Sep 23, 2008, at 7:58 AM, [EMAIL PROTECTED] wrote: hi i cant get how to configure cascades over many-to-many relations. in my case these are implicit m2m (via secondary-table), being treated as either versioned one2many, or versioned many2one. lets say there is versioned A having many

[sqlalchemy] Re: cascades over many-to-many

2008-09-23 Thread az
On Tuesday 23 September 2008 16:06:07 Michael Bayer wrote: On Sep 23, 2008, at 7:58 AM, [EMAIL PROTECTED] wrote: hi i cant get how to configure cascades over many-to-many relations. in my case these are implicit m2m (via secondary-table), being treated as either versioned one2many, or

[sqlalchemy] Re: ordering_list performance

2008-09-23 Thread jean-philippe dutreve
My use case is a bit different : new_entries can be placed everywhere into the existing SA list, not only at the end (actually it depends on the entry date). On 22 sep, 21:20, jason kirtland [EMAIL PROTECTED] wrote: Ah, looking more closely i see you're replacing self.entries with a list, not

[sqlalchemy] Cyclic references and Nullable

2008-09-23 Thread mraer
Suppose I have two classes of objects which have a reference to each other: Class A: b Class B: a Both references are mandatory so nullable = False I use post_update = True in relation function and use_alter = True in ForeignKey constructor After it I try to add two objects: session =

[sqlalchemy] Re: Relations - How?

2008-09-23 Thread g00fy
Thnx a lot Alex! I already love Pylons and SQLAlchemy! On 23 Wrz, 12:16, Alex K [EMAIL PROTECTED] wrote: Hello, here is the answer: # -*- coding: utf-8 -*- from sqlalchemy import create_engine from sqlalchemy import Table, Column, Integer, String, Unicode, MetaData, ForeignKey from

[sqlalchemy] Re: Cyclic references and Nullable

2008-09-23 Thread Alex K
And how can you do this via explicit SQL? On 23 сент, 18:32, mraer [EMAIL PROTECTED] wrote: Suppose I have two classes of objects which have a reference to each other: Class A: b Class B: a Both references are mandatory so nullable = False I use post_update = True in relation function

[sqlalchemy] Re: Cyclic references and Nullable

2008-09-23 Thread mraer
I think it depends on specific DB. In DBs I can start checking constraints after comitting a transaction, I think. On Sep 23, 6:58 pm, Alex K [EMAIL PROTECTED] wrote: And how can you do this via explicit SQL? --~--~-~--~~~---~--~~ You received this message

[sqlalchemy] multiprocessing best practices

2008-09-23 Thread mg
Hello There, I am developing an application that uses sqlalchemy and the py processing packages. My question is this, what is the best practice for using sessions in this type of app. Each subprocess needs to access my db to get work, so currently I am starting a scoped session in the run method

[sqlalchemy] Re: multiprocessing best practices

2008-09-23 Thread Laurence Rowe
On Sep 23, 4:20 pm, mg [EMAIL PROTECTED] wrote: Hello There, I am developing an application that uses sqlalchemy and the py processing packages. My question is this, what is the best practice for using sessions in this type of app. Each subprocess needs to access my db to get work, so

[sqlalchemy] Binding different engines to a session object

2008-09-23 Thread Andrew
Hi: I have been having problems in attempting to rebind a given Session object/class to a different engine instance. It seems that it can only be bound once. Subsequent sql statements post to the original binding. I am using sqlalchemy 0.4.6 with elixir. Here is an example: __session__ =

[sqlalchemy] Re: BINARY Columns in MS SQL

2008-09-23 Thread Rick Morrison
So I'm working a bit on this. If base64 encoding within the bind_processor() can fix MS-SQL for now, I'd say that would be the approach for the time being. turns out base64 encoding is problematic: it requires a corresponding decode for the data retrieval, which makes it effectively

[sqlalchemy] Re: Binding different engines to a session object

2008-09-23 Thread Andrew
I believe I have fixed my problem. Instead of binding/rebinding a given engine instance to the Session, I bind to the metadata object. This solves the problem instead. I found that there are numerous references to being able to rebind metadata but not sessions. On Sep 23, 9:03 am, Andrew

[sqlalchemy] Re: cascades over many-to-many

2008-09-23 Thread Michael Bayer
On Sep 23, 2008, at 9:06 AM, [EMAIL PROTECTED] wrote: so far i've used all and it seems to work for one single owner, but i havent really tried the multiple case. the whole thing seems to me like a splitted reference-counting mechanism, one side being weakref, other not. its not going to

[sqlalchemy] Re: Cyclic references and Nullable

2008-09-23 Thread Michael Bayer
On Sep 23, 2008, at 10:32 AM, mraer wrote: Suppose I have two classes of objects which have a reference to each other: Class A: b Class B: a Both references are mandatory so nullable = False I use post_update = True in relation function and use_alter = True in ForeignKey

[sqlalchemy] Re: Binding different engines to a session object

2008-09-23 Thread Michael Bayer
On Sep 23, 2008, at 11:03 AM, Andrew wrote: Hi: I have been having problems in attempting to rebind a given Session object/class to a different engine instance. It seems that it can only be bound once. Subsequent sql statements post to the original binding. I am using sqlalchemy 0.4.6

[sqlalchemy] Re: BINARY Columns in MS SQL

2008-09-23 Thread Michael Bayer
On Sep 23, 2008, at 4:24 PM, Rick Morrison wrote: class MSBinary(sqltypes.Binary): def bind_processor(self, dialect): def process(value): return '0x' + value.encode('hex') return process ...the issue is that the emitted value is getting quoted somewhere

[sqlalchemy] Re: Queries very slow for parsing Wikipedia dump -- any ideas for speeding it up?

2008-09-23 Thread Michael Bayer
On Sep 22, 2008, at 11:20 PM, CodeIsMightier wrote: for link_label, link_dest_title, dest_frag in self.parse_links(self.text): print 'LINK from:', repr(self.title), 'to', repr(link_dest_title + '#' + dest_frag), 'label', repr(link_label) try:

[sqlalchemy] Re: Relations - How?

2008-09-23 Thread g00fy
One more thing, If i have just book and translations 1 Book has 3 translations this sql will create me 3 rows (due to the join) isbn translation_code translation_text 1en The Book 1ru Книжка 1pl Ksiazka so if i have 10 books i will have

[sqlalchemy] Performance problem related to saving newly created objects.

2008-09-23 Thread Randallabra
Here is the scenario. I'm using SA as the data abstraction/access layer between a desktop application and postgresql database. The user interacts with the application primarily by browsing large numbers of records (on the order of tens of thousands of records at once). Occasionally the users

[sqlalchemy] Re: Performance problem related to saving newly created objects.

2008-09-23 Thread Michael Bayer
I misread your ticket and the resolution has been corrected. The commit() operation expires all objects present in the session as described in http://www.sqlalchemy.org/docs/05/session.html#unitofwork_using_committing . Turn off expire_on_commit to disable the expiration operation, which

[sqlalchemy] Re: BINARY Columns in MS SQL

2008-09-23 Thread Michael Bayer
On Sep 23, 2008, at 7:17 PM, Rick Morrison wrote: The first step here is to get a full binary round trip working with only pyodbc, no SQLA in use. Well, that's how I got as far as I did, but that was with straight text, no bind params so this is likely pyodbc assigning quoting. OK

[sqlalchemy] Re: BINARY Columns in MS SQL

2008-09-23 Thread John Hampton
Michael Bayer wrote: SQLA doesn't quote bind values. It passes bind parameters, so this is likely pyodbc assigning quoting. The first step here is to get a full binary round trip working with only pyodbc, no SQLA in use. The dialect can then be adjusted to do whatever is needed in