[sqlalchemy] Re: wx and SqlAlchemy

2008-08-28 Thread Werner F. Bruhin
Mike, Mike wrote: Hi, I am working on a wxPython application that saves data to various tables in our MS SQL Server 2000. I connect to one table and get data using a session. This works great. I then do a session.close() and then a conn.close() where conn = engine.connect(). This seems to

[sqlalchemy] Re: wx and SqlAlchemy

2008-08-28 Thread Werner F. Bruhin
Mike, Sent this a bit to quickly Mike wrote: Hi, I am working on a wxPython application that saves data to various tables in our MS SQL Server 2000. I connect to one table and get data using a session. This works great. I then do a session.close() and then a conn.close() where conn =

[sqlalchemy] Re: error when running query.count()

2008-08-28 Thread ml
I don't know how TG works. You have to ask TG users. D Mohammed Khan napsal(a): I think turbogears is maintain the mapper config?... how do I get this information out.. Thanks mfk -Original Message- From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of

[sqlalchemy] Re: Orphans not deleted using cascade parameter

2008-08-28 Thread Bob Farrell
On Wed, Aug 27, 2008 at 12:53:38PM -0700, Alex Mathieu wrote: Thanks Michael, I'll have a look over this !! Bob, thanks also for your help, however, I'm not able to use the code... maybe the indention is wrong here or I don't know... I was able to execute the function, but even by putting

[sqlalchemy] Storing UTC Dates

2008-08-28 Thread Heston James - Cold Beans
Hello Guys, This might seem like a bit of a naive question but I'm looking for your advice. Being from the UK we operate on Daylight Savings Time which gives us a one hour offset on times for a few months of the year. I currently have a DateTime column which is declared like so:

[sqlalchemy] Re: Storing UTC Dates

2008-08-28 Thread Werner F. Bruhin
Heston, Heston James - Cold Beans wrote: Hello Guys, This might seem like a bit of a naive question but I’m looking for your advice. Being from the UK we operate on Daylight Savings Time which gives us a one hour offset on times for a few months of the year. I currently have a DateTime

[sqlalchemy] Is there a simple way to let records have the same groups as it parents

2008-08-28 Thread Cecil Westerhof
I was just wondering if the folowing possible. A record has severall groups connected through a N:M relation. But it also has a parent. What I would like is that all the groups from the parent (and its parent, etc.) also are seen as group for the record. When the parent has a group added or

[sqlalchemy] Re: Storing UTC Dates

2008-08-28 Thread Heston James - Cold Beans
Hi Werner, IIUC func.now is a database function. Ah, ok, that makes fair sense. You should be able to use datetime instead i.e.: created = Column(DateTime, default=datetime.datetime.utcnow) modified = Column(DateTime, default=datetime.datetime.utcnow, onupdate=datetime.datetime.utcnow)

[sqlalchemy] Re: Is there a simple way to let records have the same groups as it parents

2008-08-28 Thread az
this is sort of inheritance of data, right? the best i've made so far about this is to get (somehow) all the Rs each with it's groups, and then do the inheritance (union over the path towards root in your case) over the result rows by hand. if u find a better way let me know... traversing a

[sqlalchemy] Re: wx and SqlAlchemy

2008-08-28 Thread Mike
Hi Werner, On Aug 28, 1:39 am, Werner F. Bruhin [EMAIL PROTECTED] wrote: Mike, Sent this a bit to quickly Mike wrote: Hi, I am working on a wxPython application that saves data to various tables in our MS SQL Server 2000. I connect to one table and get data using a session. This

[sqlalchemy] Re: wx and SqlAlchemy

2008-08-28 Thread Cecil Westerhof
2008/8/28 Mike [EMAIL PROTECTED]: Does this work for multiple databases? This particular program I am working on will be connecting to 2 or 3 databases and a table or three in each of those. I'm pretty sure I have to create separate engines for each db and probably bind separate sessions for

[sqlalchemy] Re: Is there a simple way to let records have the same groups as it parents

2008-08-28 Thread Cecil Westerhof
2008/8/28 [EMAIL PROTECTED]: this is sort of inheritance of data, right? You could it call like that I suppose. the best i've made so far about this is to get (somehow) all the Rs each with it's groups, and then do the inheritance (union over the path towards root in your case) over the

[sqlalchemy] Re: loading tables is very slow

2008-08-28 Thread vkuznet
Hi, so I modified a code to use hotshot module, basically I added profiler = hotshot.Profile(profile.dat) profiler.run(loadTables(tableNames)) profiler.close() to my code instead of just calling loadTables function. Results are below. I played with code a little bit and it seems to me that most

[sqlalchemy] running average

2008-08-28 Thread dirjoe
Hi, is there a way to query on running averages in sqlalchemy? Eg for a baseball database how could I query on a team scored 2 more runs then their year-to-date average? Thanks for any clues. joe --~--~-~--~~~---~--~~ You received this message because you are

[sqlalchemy] Result set slice (session.query)

2008-08-28 Thread PyDevler
I am using the ORM query strategy using session.query. I vaguely remember seeing in the past that doing a slice on the result set, i.e. result[:10] used to perform a Limit/Offset query, it may not have been so. Nevertheless, with SA 0.5beta3 this is definitely not the case. It seems that limit

[sqlalchemy] Re: Is there a simple way to let records have the same groups as it parents

2008-08-28 Thread Michael Bayer
On Aug 28, 2008, at 8:11 AM, Cecil Westerhof wrote: I was just wondering if the folowing possible. A record has severall groups connected through a N:M relation. But it also has a parent. What I would like is that all the groups from the parent (and its parent, etc.) also are seen as

[sqlalchemy] Re: loading tables is very slow

2008-08-28 Thread Michael Bayer
Below, you can see that establishing the database connection itself to oracle is taking 1.8 seconds (connect() on the SQLA side). And a huge 2.9 seconds to fetch just 25 rows from your Oracle database (_fetchone_impl on the SQLA side, which calls cursor.fetchone(), a cx_oracle native

[sqlalchemy] Re: Is there a simple way to let records have the same groups as it parents

2008-08-28 Thread Cecil Westerhof
2008/8/28 Michael Bayer [EMAIL PROTECTED]: On Aug 28, 2008, at 8:11 AM, Cecil Westerhof wrote: I was just wondering if the folowing possible. A record has severall groups connected through a N:M relation. But it also has a parent. What I would like is that all the groups from the parent

[sqlalchemy] Re: Result set slice (session.query)

2008-08-28 Thread Michael Bayer
On Aug 28, 2008, at 12:18 AM, PyDevler wrote: I am using the ORM query strategy using session.query. I vaguely remember seeing in the past that doing a slice on the result set, i.e. result[:10] used to perform a Limit/Offset query, it may not have been so. Nevertheless, with SA 0.5beta3

[sqlalchemy] Re: Is there a simple way to let records have the same groups as it parents

2008-08-28 Thread Michael Bayer
On Aug 28, 2008, at 10:54 AM, Cecil Westerhof wrote: On the Query side, the basic job is to formulate joins to the parent, Would it no be better to the child? Otherwise you need to traverse all records, which would be inefficient -I think- when for example only 1% of the records are in

[sqlalchemy] Re: wx and SqlAlchemy

2008-08-28 Thread Werner F. Bruhin
Mike, Mike wrote: ... Does this work for multiple databases? This particular program I am working on will be connecting to 2 or 3 databases and a table or three in each of those. I'm pretty sure I have to create separate engines for each db and probably bind separate sessions for those.

[sqlalchemy] Re: wx and SqlAlchemy

2008-08-28 Thread Mike
Hi, Here's what I'm doing. I have a timesheet application written in wxPython. It works, but I think it would work better if I changed the database calls into SA calls. There are 3 databases. I created one and the other two are pre-existing. The one I created is the one I store all the user

[sqlalchemy] Re: wx and SqlAlchemy

2008-08-28 Thread Werner F. Bruhin
Mike, Mike wrote: Hi, Here's what I'm doing. I have a timesheet application written in wxPython. It works, but I think it would work better if I changed the database calls into SA calls. There are 3 databases. I created one and the other two are pre-existing. The one I created is the one I

[sqlalchemy] Re: Result set slice (session.query)

2008-08-28 Thread Michael Bayer
On Aug 28, 2008, at 12:40 PM, PyDevler wrote: Hi Michael, (Sorry for the repost at sqlalchemy-devel I was not able to find this post, so I thought it didnt go through) I can write up a small sample later. When I turn echoing on the DB engine, I can see that doing: query[start:end]

[sqlalchemy] Re: Result set slice (session.query)

2008-08-28 Thread PyDevler
Hi Michael, (Sorry for the repost at sqlalchemy-devel I was not able to find this post, so I thought it didnt go through) I can write up a small sample later. When I turn echoing on the DB engine, I can see that doing: query[start:end] issues the full query, not using limit, offset.

[sqlalchemy] Re: wx and SqlAlchemy

2008-08-28 Thread Mike
Werner, On Aug 28, 11:24 am, Werner F. Bruhin [EMAIL PROTECTED] wrote: Mike, Mike wrote: Hi, Here's what I'm doing. I have a timesheet application written in wxPython. It works, but I think it would work better if I changed the database calls into SA calls. There are 3 databases. I

[sqlalchemy] Re: Is there a simple way to let records have the same groups as it parents

2008-08-28 Thread az
On Thursday 28 August 2008 18:00:08 Michael Bayer wrote: On Aug 28, 2008, at 10:54 AM, Cecil Westerhof wrote: On the Query side, the basic job is to formulate joins to the parent, Would it no be better to the child? Otherwise you need to traverse all records, which would be inefficient

[sqlalchemy] Re: Result set slice (session.query)

2008-08-28 Thread PyDevler
On Aug 28, 10:50 am, Michael Bayer [EMAIL PROTECTED] wrote: I cant reproduce query[start:end] not producing LIMIT/OFFSET. Actually that is right: query[start:end] does produce limit/offset. What I was doing was: query[:end] Since in lists start defaults to 0, that does not produce a

[sqlalchemy] Re: Result set slice (session.query)

2008-08-28 Thread Michael Bayer
On Aug 28, 2008, at 2:59 PM, PyDevler wrote: On Aug 28, 10:50 am, Michael Bayer [EMAIL PROTECTED] wrote: I cant reproduce query[start:end] not producing LIMIT/OFFSET. Actually that is right: query[start:end] does produce limit/offset. What I was doing was: query[:end] Since

[sqlalchemy] Extension Mapper

2008-08-28 Thread GustaV
Hi all. I'm currently working on a map (like in geography :) ) When a new tile in inserted in the DB, I'm using an extension mapper to update some neighbor's properties (like the neighbors count). The after_insert method helps a lot... but: When I modify another object than the one being

[sqlalchemy] Re: Extension Mapper

2008-08-28 Thread Michael Bayer
On Aug 28, 2008, at 6:57 PM, GustaV wrote: Hi all. I'm currently working on a map (like in geography :) ) When a new tile in inserted in the DB, I'm using an extension mapper to update some neighbor's properties (like the neighbors count). The after_insert method helps a lot... but: