[sqlalchemy] Re: Working around capitalization problems moving from MySQL to Oracle

2009-03-19 Thread Michael Bayer
On Mar 19, 2009, at 7:50 PM, loctones wrote: > > I'm moving the database which drives a program from MySQL to Oracle. > The original implementation of the database columns was in CamelCase. > My company dictates that all caps be used for column names. > > In the sqlalchemy documentation, I found

[sqlalchemy] Working around capitalization problems moving from MySQL to Oracle

2009-03-19 Thread loctones
I'm moving the database which drives a program from MySQL to Oracle. The original implementation of the database columns was in CamelCase. My company dictates that all caps be used for column names. In the sqlalchemy documentation, I found this quote: Names which contain no upper case characters

[sqlalchemy] Re: null() and notnull()

2009-03-19 Thread Michael Bayer
On Mar 19, 2009, at 12:34 PM, jo wrote: > > Michael Bayer wrote: >> why dont you just stick with None instead of "nn" ? then you just >> write: >> >> if v is None: >>clause.append(self.c.field != v) >> else: >> clause.append(self.c.field == v) > It could be an idea but not intuitive and

[sqlalchemy] Re: null() and notnull()

2009-03-19 Thread jo
Michael Bayer wrote: > why dont you just stick with None instead of "nn" ? then you just > write: > > if v is None: > clause.append(self.c.field != v) > else: >clause.append(self.c.field == v) It could be an idea but not intuitive and unnatural because None = IS NOT NULL (very ugly

[sqlalchemy] Re: null() and notnull()

2009-03-19 Thread jo
a...@svilendobrev.com wrote: >> def search( self, **kw ): >> by_where_clause = {} >> for k,v in kw.items(): >> by_where_clause[ k ] = v >> > i guess u want to do query.filter_by(**by_where_clause) after that? > This is the final result, and I'm not problems abo

[sqlalchemy] Re: null() and notnull()

2009-03-19 Thread Michael Bayer
why dont you just stick with None instead of "nn" ? then you just write: if v is None: clause.append(self.c.field != v) else: clause.append(self.c.field == v) On Mar 19, 2009, at 11:43 AM, jo wrote: > > Well, MIchael, in my case a notnull() function could be very > interesting be

[sqlalchemy] Re: null() and notnull()

2009-03-19 Thread az
> def search( self, **kw ): > by_where_clause = {} > for k,v in kw.items(): > by_where_clause[ k ] = v i guess u want to do query.filter_by(**by_where_clause) after that? it's just a syntax sugar over .filter(). so by_where_clause = [] for k,v in kw.items(

[sqlalchemy] Re: null() and notnull()

2009-03-19 Thread jo
Well, MIchael, in my case a notnull() function could be very interesting because I'm using it in a function, and would like pass values as parameters in such way: def search( self, **kw ): by_where_clause = [] for k,v in kw.items(): if k == 'myfield1': i

[sqlalchemy] Re: is_backref & circular cloning

2009-03-19 Thread Martin
Thanks for the answers, actually this thread-head-post had been deleted, sorry for the duplicate threads and now dangling replies in this one, Martin On Mar 19, 3:11 pm, a...@svilendobrev.com wrote: > this clone stuff comes over and over and over... > i have similar .copy() in dbcook unfini

[sqlalchemy] Re: 0.5.2 & is_backref property & circular cloning

2009-03-19 Thread Martin
gotcha, thanks :) btw, love SA, one of the reasons i use pylons when I can and not Django, Martin On Mar 19, 4:00 pm, Michael Bayer wrote: > On Mar 19, 2009, at 10:39 AM, Martin wrote: > > > > > I dont see it, especially since from the docs: > > > When given an instance, it follows these st

[sqlalchemy] Re: 0.5.2 & is_backref property & circular cloning

2009-03-19 Thread Michael Bayer
On Mar 19, 2009, at 10:39 AM, Martin wrote: > > I dont see it, especially since from the docs: > > When given an instance, it follows these steps: >* It examines the primary key of the instance. If it’s > present, it attempts to load an instance with that primary key (or > pulls from the

[sqlalchemy] Re: Sorting by related property

2009-03-19 Thread Joril
On 19 Mar, 15:09, Martin wrote: > I guess > > q = session.query(A).join('b').order_by(B.code).all() > > should do the trick, at least it did under 0.4.8 It works in 0.5.2 too, thanks :) I was wondering though, maybe 0.5.x has a way to do it without the join? I mean, SQLA should have all the info

[sqlalchemy] Re: 0.5.2 & is_backref property & circular cloning

2009-03-19 Thread Martin
I dont see it, especially since from the docs: When given an instance, it follows these steps: * It examines the primary key of the instance. If it’s present, it attempts to load an instance with that primary key (or pulls from the local identity map). the instances are in the session an

[sqlalchemy] Re: is_backref & circular cloning

2009-03-19 Thread az
this clone stuff comes over and over and over... i have similar .copy() in dbcook unfinished.. 1) see prop.direction as one of (ONETOMANY, MANYTOONE, MANYTOMANY) to figure  the "direction" of the relation. why does it matter which side you're on? as long as u copy one side only.. as of 2) .. d

[sqlalchemy] Re: 0.5.2 & is_backref property & circular cloning

2009-03-19 Thread Michael Bayer
On Mar 19, 2009, at 10:13 AM, Martin wrote: > > there surely must be an easier way to do a deep clone of everything > except session/SA data and manually specified properties (like ID's, > or ViewOnly references) a session.merge() actually performs a deep clone. --~--~-~--~~--

[sqlalchemy] Re: is_backref & circular cloning

2009-03-19 Thread Michael Bayer
On Mar 19, 2009, at 9:44 AM, Martin wrote: > > I've written my own deep_clone for SA Object Trees, which is > exploiting quite some lowlevel calls inside SA > > This has brought me to reimplement the cloning for every major version > change, I started in 0.3, updated to 0.4 with some major rewor

[sqlalchemy] 0.5.2 & is_backref property & circular cloning

2009-03-19 Thread Martin
I've written my own deep_clone for SA Object Trees, which is exploiting quite some lowlevel calls inside SA This has brought me to reimplement the cloning for every major version change, I started in 0.3, updated to 0.4 with some major rework, but I simply cant get it to work with 0.5.2, and I wo

[sqlalchemy] Re: Sorting by related property

2009-03-19 Thread Martin
I guess q = session.query(A).join('b').order_by(B.code).all() should do the trick, at least it did under 0.4.8 Martin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send e

[sqlalchemy] Re: Adding MapperExtensions after Mappers created

2009-03-19 Thread Michael Bayer
not a stupid question at all, i wasn't being sarcastic if that's what came across. I honestly didnt have time to look at the source myself to see what it was called (it could have been "extensions" and "add()", for example). On Mar 19, 2009, at 5:16 AM, jarrod.ches...@gmail.com wrote: > >

[sqlalchemy] Re: null() and notnull()

2009-03-19 Thread Michael Bayer
well usually null() and not_(null()) aren't needed as explicit constructs.comparisons like somecol == None and somecol != None will generate the appropriate NULL/NOT NULL expression. On Mar 19, 2009, at 4:48 AM, jo wrote: > > Hi all, > > I would like to know if there's a notnull() funct

[sqlalchemy] Sorting by related property

2009-03-19 Thread Joril
Hi everyone! I have a simple many-to-one relation between class A and class B, and I'd like to use a Query to get the "A" instances sorted by a B attribute (e.g. "code").. I tried with something like this: q = session.query(A) q.order_by(A.list_of_b.code) but obviously "list_of_b" doesn't know a

[sqlalchemy] is_backref & circular cloning

2009-03-19 Thread Martin
I've written my own deep_clone for SA Object Trees, which is exploiting quite some lowlevel calls inside SA This has brought me to reimplement the cloning for every major version change, I started in 0.3, updated to 0.4 with some major rework, but I simply cant get it to work with 0.5.2, and I wo

[sqlalchemy] Re: adding some sql function to several dialects

2009-03-19 Thread che
Thanks, Michael i end with the following: # from sqlalchemy.sql.expression import _Function class year( _Function): __visit_name__ = 'year' def __init__(self, value): self.value = value _Function.__init__( self, self.__visit_name__) def _compiler_dispatch(se

[sqlalchemy] Re: Any one tried to use SqlAlchemy with XML RPC?

2009-03-19 Thread 一首诗
The actual reason why I need "XML RPC" is not because I need RPC. Actaully I need XML. I need to represent SA objects in text format so systems using programming language other than python could decode them. On Mar 19, 1:27 pm, Andreas Jung wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SH

[sqlalchemy] Re: Application performance

2009-03-19 Thread Alex K
DB is utf-8 encoded/collated etc. On Mar 19, 1:22 pm, Noah Gift wrote: > On Thu, Mar 19, 2009 at 11:20 PM, Andreas Jung wrote: > > -BEGIN PGP SIGNED MESSAGE- > > Hash: SHA1 > > > On 19.03.2009 11:14 Uhr, Alex K wrote: > > > Well, it does not affect the performance and I still get: > > >

[sqlalchemy] Re: Application performance

2009-03-19 Thread Noah Gift
On Thu, Mar 19, 2009 at 11:20 PM, Andreas Jung wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 19.03.2009 11:14 Uhr, Alex K wrote: > > Well, it does not affect the performance and I still get: > > The Python profiler will tell you exactly about bottlenecks. > So go and profile you

[sqlalchemy] Re: Application performance

2009-03-19 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 19.03.2009 11:14 Uhr, Alex K wrote: > Well, it does not affect the performance and I still get: The Python profiler will tell you exactly about bottlenecks. So go and profile your code. - -aj -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (Da

[sqlalchemy] Re: Application performance

2009-03-19 Thread Alex K
Well, it does not affect the performance and I still get: Server Software:Apache/2.2.8 Server Hostname:localhost Server Port:80 Document Path: /l Document Length:87305 bytes Concurrency Level: 100 Time taken for tests: 17.146102 seconds Comple

[sqlalchemy] Re: Application performance

2009-03-19 Thread Mike Conley
I believe #1 will iterate on the cursor retrieving one object from cursor on each iteration, while #2 retrieves all objects then processes the entire result set in Python. Try changing #1 to use for o in session.query(Object).all() to retrieve all objects before doing the iteration, same as

[sqlalchemy] Re: Adding MapperExtensions after Mappers created

2009-03-19 Thread jarrod.ches...@gmail.com
When i look at the variables in debug mode, It looks like a dict as it has { } which is why i didn't think it was a collection. I looked again and it is an instance of ExtensionCarrier and that has a method called append() I do search the mail list and the documents before asking stupid questions

[sqlalchemy] null() and notnull()

2009-03-19 Thread jo
Hi all, I would like to know if there's a notnull() function in sqlalchemy similar to null() to avoid things like not_(null()) ? thank you j --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To

[sqlalchemy] Application performance

2009-03-19 Thread Alex K
Hi All, I need an advice, take a look at this code sample: engine = create_engine(url,encoding = 'utf-8',echo = False,pool_size = 100) metadata = MetaData() object_table = Table('_object', metadata, Column('id', Integer, primary_key=True), Column('_owner_id

[sqlalchemy] Re: Any one tried to use SqlAlchemy with XML RPC?

2009-03-19 Thread Arthur Pemberton
On Thu, Mar 19, 2009 at 2:34 AM, Andreas Jung wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 19.03.2009 8:32 Uhr, Arthur Pemberton wrote: >> 2009/3/19 Andreas Jung : >>> -BEGIN PGP SIGNED MESSAGE- >>> Hash: SHA1 >>> >>> On 19.03.2009 6:49 Uhr, Arthur Pemberton wrote: >>>

[sqlalchemy] Re: Any one tried to use SqlAlchemy with XML RPC?

2009-03-19 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 19.03.2009 8:32 Uhr, Arthur Pemberton wrote: > 2009/3/19 Andreas Jung : >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> On 19.03.2009 6:49 Uhr, Arthur Pemberton wrote: >> >>> SQLAlchemy needs a concept of Data Transfer Objects so that it c

[sqlalchemy] Re: Any one tried to use SqlAlchemy with XML RPC?

2009-03-19 Thread Arthur Pemberton
2009/3/19 Andreas Jung : > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 19.03.2009 6:49 Uhr, Arthur Pemberton wrote: > >> >> SQLAlchemy needs a concept of Data Transfer Objects so that it can be >> easily transmitted and reconstituted as necessary and everyone doesn't >> have to reimplem