Re: [sqlalchemy] Handling detached instances

2014-10-01 Thread Wichert Akkerman
On 30 Sep 2014, at 23:18, tonthon tontho...@gmail.com wrote: I didn't knew merge was supposes to be used in such a case, it works like a charm. Following that tip, I've added this decorator : def cache_wrapper(func): ensure a model returned from a cached function

Re: [sqlalchemy] too many SQL variables in in_

2014-09-13 Thread Wichert Akkerman
On 13 Sep 2014, at 11:25, pyArchInit ArcheoImagineers pyarchi...@gmail.com wrote: Il giorno giovedì 11 settembre 2014 18:39:24 UTC+2, Jonathan Vanasco ha scritto: i once thought about extending SqlAlchemy to handle this issue behind the scenes, but each database treats `IN()`

Re: [sqlalchemy] How can I make a rollback in a sequence?

2014-08-20 Thread Wichert Akkerman
On 20 Aug 2014, at 20:02, Rafael Henrique da Silva Correia rafaelhenr...@gmail.com wrote: Hi ! I have a block of code similar to this I made to test: def TEST(): teste = Test(descricao=str('wololo')) try: db.session.add(wololo) db.session.commit()

Re: [sqlalchemy] Session.execute() calls aren't committing...

2014-04-17 Thread Wichert Akkerman
On 17 Apr 2014, at 04:43, Chip Kellam blackroomd...@gmail.com wrote: I have an application in which I primarily rely on MySQL/InnoDB and using the SQLAlchemy ORM and leveraging the transaction python module. Everything is good. My problem is that, try as I might, using code similar to

Re: [sqlalchemy] celery and race conditions

2014-04-15 Thread Wichert Akkerman
On 15 Apr 2014, at 01:12, Jonathan Vanasco jonat...@findmeon.com wrote: i've got that now as a stopgap; i was hoping someone has better ideas. i don't like the idea of a post-commit hook, because i fear requesting the celery task request will create an error. I really don't want to build

Re: [sqlalchemy] defining a relationship with IS NOT

2014-04-15 Thread Wichert Akkerman
On 15 Apr 2014, at 13:25, Richard Gerd Kuesters rich...@humantech.com.br wrote: interesting, i didn't knew that :D i was using shomething like (for softwares such as st2, which has pep8 checking): ## variables NULL = None # f**k pep-8 TRUE = True # f**k pep-8 FALSE = False #

Re: [sqlalchemy] query returns sqlalchemy.util._collections.KeyedTuple. not a maped class instance

2014-04-15 Thread Wichert Akkerman
On 15 Apr 2014, at 13:06, robert rob...@redcor.ch wrote: Hi there, I m using SQLAlchemy V. 8.6 together with geomalcheny 2.4a second I get a call I have a a mapped class: # tblKey2goGdataLocation # #

Re: [sqlalchemy] SQLAlchemy 0.9.1 released

2014-01-07 Thread Wichert Akkerman
On 08 Jan 2014, at 01:26, limodou limo...@gmail.com wrote: But I don't know why make this decision. Because where NULL will get nothing. And in 0.8.X version, I need to combine multiple condition according user input to one condition, so my code just like: cond = None for c in

Re: [sqlalchemy] PostgreSQL: interval columns, values measured in months or years

2013-12-25 Thread Wichert Akkerman
On 25 Dec 2013, at 00:27, David Bolen db3l@gmail.com wrote: Sibylle Koczian nulla.epist...@web.de writes: Exactly, that's it. The stackoverflow discussion was very instructive, thank you! I'll try out psycopg2-dateutils. I'm a big fan of dateutil. If you do use it, you may also

Re: [sqlalchemy] PostgreSQL: interval columns, values measured in months or years

2013-12-25 Thread Wichert Akkerman
On 24 Dec 2013, at 08:11, Laurence Rowe laurencer...@gmail.com wrote: Postgres' INTERVAL supports deltas of quantities other than days, +1 month may mean 28/29/30/31 days depending on the month. From

Re: [sqlalchemy] Using session.execute to bulk-insert into MySQL

2013-10-02 Thread Wichert Akkerman
On Oct 2, 2013, at 3:53 AM, Jonathan Vanasco jonat...@findmeon.com wrote: do you recall if `flush()` initiated 'mark_changed' at some point in history? i thought it did. I'm pretty sure it never did that. Wichert. -- You received this message because you are subscribed to the Google

Re: [sqlalchemy] Using session.execute to bulk-insert into MySQL

2013-10-01 Thread Wichert Akkerman
This message did not make it to the list last time, lets see if it work now.. On Sep 29, 2013, at 2:41 PM, Roman Iten roman.i...@sg-unteraegeri.ch wrote: Hi I started a pyramid project using the alchemy scaffold (includes ZopeTransactionExtension to scope sessions to requests, see [1]).

Re: [sqlalchemy] possible bug in InstrumentedAttribute.__delete__?

2013-07-14 Thread Wichert Akkerman
On Jul 13, 2013, at 22:59, Michael Bayer mike...@zzzcomputing.com wrote: The original intent of default for Column is that it acts exactly like server_default, except it runs on the Python side for the case that your schema wasn't created with this default, or the functionality of your

Re: [sqlalchemy] between .one() and .first()

2013-06-17 Thread Wichert Akkerman
On Jun 17, 2013, at 08:58 , Chris Withers ch...@simplistix.co.uk wrote: Hi All, I seems to commonly need to do a query which should return zero or one mapped objects. .one() isn't what I want as no returned object is ok. .first() isn't what I want as if my query would return more

Re: [sqlalchemy] sqlalchemy does not enforce foreign key constraint

2013-05-23 Thread Wichert Akkerman
On May 23, 2013, at 07:16 , Shyam Purkayastha shyam.g...@gmail.com wrote: I am trying to play with the sql alchemy ORM based db definition with an inmemory sqlite db. SQLite does not enforce foreign key constraints unless you manually tell it to. You can do that with a PRAGMA

Re: [sqlalchemy] Relate to Object by Two Refs

2013-05-16 Thread Wichert Akkerman
On May 16, 2013, at 03:09 , Ji Zhang zhangj...@gmail.com wrote: Hi, Say I have a Request model and User model: class Request(Base): id = Column(Integer, primary_key=True) user_id = Column(Integer) admin_id = Column(Integer) class User(Base): id = Column(Integer,

[sqlalchemy] Using a UUID as primary key

2013-05-06 Thread Wichert Akkerman
I was looking at using a UUID as primary key for a table. Using the backend-agnostic GUID type from http://docs.sqlalchemy.org/en/rel_0_8/core/types.html#backend-agnostic-guid-type I get strange behaviour though. I whipped up a simple test case: class Data(BaseObject): __tablename__ =

[sqlalchemy] Re: Using a UUID as primary key

2013-05-06 Thread Wichert Akkerman
For reference I have attached a complete test case including a copy of the GUID code from the documentation. On May 6, 2013, at 23:22, Wichert Akkerman wich...@wiggy.net wrote: I was looking at using a UUID as primary key for a table. Using the backend-agnostic GUID type from http

Re: [sqlalchemy] SA 0.8.0 UnicodeDecodeError with Postgres 9.1.9

2013-04-19 Thread Wichert Akkerman
On Apr 19, 2013, at 08:54 , Andreas Jung j...@lpcnv.com wrote: Problem seems to be related how I moved the database (pg_dump + pg_restore). After moving the database files directory I can no longer reproduce this error. I would guess you loaded your database dump into a database with a

Re: [sqlalchemy] updating with a Session ?

2013-02-06 Thread Wichert Akkerman
On Feb 6, 2013, at 03:05 , Jonathan Vanasco jonat...@findmeon.com wrote: I use SqlAlchemy in a Pyramid app. All my models, connections, etc are within and set up by Pyramid. I'm trying to do a maintenance script, and am a bit confused. In my script, thanks to a bootstraped commandline

Re: [sqlalchemy] Docs in PDF are not being generated

2013-01-30 Thread Wichert Akkerman
On Jan 30, 2013, at 17:53 , Michael Bayer mike...@zzzcomputing.com wrote: I've asked people before about this seemingly ridiculous generate twice requirement of LaTeX and I get these incredulous answers like why? what's wrong with running it twice?, as though I'm being unreasonable. It is

Re: [sqlalchemy] Couple of questions about filtering...

2013-01-22 Thread Wichert Akkerman
On Jan 22, 2013, at 08:26 , Alexey Vihorev viho...@gmail.com wrote: Hi. Couple of questions... 1. Does SQLA support deep filtering, i.e. something like this: query(Invoice).filter(Invoice.Customer.Country.name=='France') You'll need to use a join to do this:

Re: [sqlalchemy] SQLAlchemy 0.8.0b2 released

2012-12-16 Thread Wichert Akkerman
On Dec 14, 2012, at 22:11, Michael Bayer mike...@zzzcomputing.com wrote: But the effect of only publishing 0.8.0b1 on Sourceforge was that I didn't get the impression that we had so many people going out and testing the beta as we normally do. I was reminded by Chris McDonough that a

Re: [sqlalchemy] mixing association proxies and mixin classes

2012-06-21 Thread Wichert Akkerman
, cascade='all,delete,delete-orphan') there's a patch for 0.8 only in http://www.sqlalchemy.org/trac/ticket/2517 . On Jun 20, 2012, at 1:13 PM, Wichert Akkerman wrote: I am struggling a little bit with mixin classes. The pattern I am trying to implement is a mixin-class that adds a list

[sqlalchemy] mixing association proxies and mixin classes

2012-06-20 Thread Wichert Akkerman
I am struggling a little bit with mixin classes. The pattern I am trying to implement is a mixin-class that adds a list of validated search queries to a model. A minimised version of the code is below. The problem I am running into is that putting an association_proxy on a mixin class does not

Re: [sqlalchemy] How to (quick) check if a table exists in schema?

2012-04-25 Thread Wichert Akkerman
On 04/25/2012 03:57 PM, Massi wrote: Hi everyone, in my script I have to deal with a huge database with thousands of tables. Given a table name (a python string) I would have to now if such a table exists or not. Up to now I have written this function: def DBGetTableByName(table_name) :

Re: [sqlalchemy] stucco_evolution 0.4 released

2012-04-20 Thread Wichert Akkerman
On 04/19/2012 07:43 PM, Michael Bayer wrote: If you've seen my recent talks you saw that I'm a little skeptical of what you're terming non-monolithic databases.Let's say this means, a database with a set of tables maintained by entirely different packages, but with the possibility of

Re: [sqlalchemy] dogpile.cache 0.1.0 released

2012-04-09 Thread Wichert Akkerman
retools (http://readthedocs.org/docs/retools/en/latest/), other than that dogpile does not support redis and retools only supports redis? Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. -- You

Re: [sqlalchemy] dogpile.cache 0.1.0 released

2012-04-09 Thread Wichert Akkerman
On 2012-4-9 18:28, Michael Bayer wrote: On Apr 9, 2012, at 11:49 AM, Wichert Akkerman wrote: On 2012-4-9 17:28, Michael Bayer wrote: There's a decent README up now at http://pypi.python.org/pypi/dogpile.cache and you can read all the docs at http://dogpilecache.readthedocs.org/. I'm

[sqlalchemy] late-binding association proxy fixes error with ordered many-to-many list

2012-02-07 Thread Wichert Akkerman
I have been looking at making an ordered many-to-many list. The example from Jason Kirkland from 2008 (http://groups.google.com/group/sqlalchemy/browse_thread/thread/611c88ee27354246 ) worked, but our version of it did not. I have modified his version (see code at the end of the mail) to use

Re: [sqlalchemy] Anticipating an IntegrityError before it happens (or noticing it immediately after)

2012-01-22 Thread Wichert Akkerman
. If your backend support it you might be able to get away with using savepoints (see http://www.sqlalchemy.org/docs/orm/session.html#using-savepoint ). Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things

Re: [sqlalchemy] a question about engine in sqlalchemy

2012-01-15 Thread Wichert Akkerman
http://www.sqlalchemy.org/docs/core/engines.html#database-urls for documentation on database URLs. Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. -- You received this message because you

Re: [sqlalchemy] migration to trac 0.12

2011-12-30 Thread Wichert Akkerman
On 12/30/2011 02:36 AM, Michael Bayer wrote: Hi all - Just in the interests of keeping fresh, I've upgraded Trac from 0.11 to 0.12, as part of a migration of all of sqlalchemy.org to a new host. Assuming your dns has switched, you'll be browsing around the updated interface which has some

Re: [sqlalchemy] add results in a python object

2011-11-23 Thread Wichert Akkerman
On 11/17/2011 01:42 PM, raulna wrote: Hi, i need save results in a python object from multiples querys, like: for user in users: phones = DBSession.query(Phone).filter('... python_object = python_object + phones ? How can i append this results in

Re: [sqlalchemy] Properly handling sessions in rollback

2011-11-14 Thread Wichert Akkerman
On 11/13/2011 06:51 PM, Vlad K. wrote: Yes, again thanks for joining the topic there. Savepoints are doable by zope.transaction I am just not sure to what extent. I can't seem to find any docs and I have to walk through the code and not all features are commented or docstring'd. They should

Re: [sqlalchemy] default NULL

2011-11-11 Thread Wichert Akkerman
On 11/11/2011 11:20 AM, Alex K wrote: Thanks, but if I need allow nullable primary_keys it not works. I tried: user_id = db.Column(db.Integer, db.ForeignKey('user.id http://user.id', ondelete='SET NULL'), primary_key=True, nullable=True, server_default=text('NULL')) A primary key can never

[sqlalchemy] association proxy not persisting?

2011-11-01 Thread Wichert Akkerman
I am fighting a bit of an odd issue (using SQLAlchemy 0.7.3). I have an account class, where each account has a list of strings managed via an association proxy. For a reason I can't seem to find the values are not persisted. The test case below demonstrates this: SQLAlchemy prints a Object of

Re: [sqlalchemy] deferrable constraints

2011-09-27 Thread Wichert Akkerman
I hate to do this kind of thing, but I haven't gotten any feedback on this and I would love to hear some feedback/opinions. How do other people handle deferrable constraints? On 2011-9-14 13:59, Wichert Akkerman wrote: On 09/14/2011 12:25 PM, Wichert Akkerman wrote: Constraints marked

Re: [sqlalchemy] obtaining * field when more than 1 table

2011-09-16 Thread Wichert Akkerman
use the power of python: Session.query(Files.original_name, *[c.name for c in MSPResponse.__table__.c]) Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. -- You received this message

[sqlalchemy] update for polymorphic types

2011-09-15 Thread Wichert Akkerman
I am correct in assuming that update() does not work on polymorphic classes? I'm getting a ArgumentError: Only update via a single table query is currently supported error which seems to suggest that is the case. Wichert. -- You received this message because you are subscribed to the Google

Re: [sqlalchemy] update for polymorphic types

2011-09-15 Thread Wichert Akkerman
On 09/15/2011 04:13 PM, Michael Bayer wrote: that is the case you'd need to emit UPDATE against each table individually I tried that quickly but still got the same error. My model looks like this (the full thing is at

[sqlalchemy] deferrable constraints

2011-09-14 Thread Wichert Akkerman
Constraints marked as deferrable result in a syntax error when using SQLite. Is this deliberate, or a bug in the sqlite dialect? Regards, Wichert. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

Re: [sqlalchemy] deferrable constraints

2011-09-14 Thread Wichert Akkerman
On 09/14/2011 12:25 PM, Wichert Akkerman wrote: Constraints marked as deferrable result in a syntax error when using SQLite. Is this deliberate, or a bug in the sqlite dialect? As a workaround I figured I could use events to only add deferrable constraint variants on PostgreSQL and use

Re: [sqlalchemy] use session inside the class

2011-09-02 Thread Wichert Akkerman
On 09/02/2011 03:31 AM, Michael Bayer wrote: With SQLAlchemy you should have an ongoing transaction/session defined externally to individual operations on your mapped objects - SQLA uses the unit of work pattern which specifically is about grouping related persistence/query operations

Re: [sqlalchemy] Re: group_by argument as a result of a query

2011-08-15 Thread Wichert Akkerman
On 08/15/2011 10:20 AM, Eduardo wrote: Here is the example: column_names = session.query(tab.c.name).filter(tab.c.value==354) column_names = [column_name for (column_name,) in column_names]

Re: [sqlalchemy] Re: Softcoding .filter(...)

2011-08-12 Thread Wichert Akkerman
On 08/12/2011 05:52 PM, NiL wrote: say you want to filter on the 'field' (field would be a string representing the name of the field) on objects of class == Klass field_attr = getattr(Klass, field) would give you the instrumented attribute then Session.query(Klass).filter(field_attr ==

[sqlalchemy] ordered many-to-many relation

2011-08-09 Thread Wichert Akkerman
I have a model where I have articles and images, with a many-to-many relation between them. Since the order of images for an article is important this relation should be ordered from the article site. My naieve implementation looks like this: article_images = Table('article_image',

Re: [sqlalchemy] ordered many-to-many relation

2011-08-09 Thread Wichert Akkerman
On 08/09/2011 02:38 PM, Wichert Akkerman wrote: I have a model where I have articles and images, with a many-to-many relation between them. Since the order of images for an article is important this relation should be ordered from the article site. My naieve implementation looks like

Re: [sqlalchemy] Declarative Field Type 'Alias'

2011-08-06 Thread Wichert Akkerman
On 08/05/2011 10:46 PM, Mark Erbaugh wrote: This is more of a Python issue than a SA issue, but I had trouble getting this to work. I did, but the code seems a little awkard to mesigh. In addition to the requirements already, I also wanted toe default value to be a class level 'constant'.

Re: [sqlalchemy] mortar_rdb 1.2.0 released!

2011-07-17 Thread Wichert Akkerman
On 2011-7-17 11:07, Chris Withers wrote: On 30/06/2011 09:30, Wichert Akkerman wrote: On 06/30/2011 10:14 AM, Chris Withers wrote: - Specify sqlalchemy 0.6 as a requirement, until zope.sqlalchemy is ported, mortar_rdb shouldn't be used with :mod:`sqlalchemy` 0.7. What is missing

Re: [sqlalchemy] mortar_rdb 1.2.0 released!

2011-06-30 Thread Wichert Akkerman
On 06/30/2011 10:14 AM, Chris Withers wrote: - Specify sqlalchemy 0.6 as a requirement, until zope.sqlalchemy is ported, mortar_rdb shouldn't be used with :mod:`sqlalchemy` 0.7. What is missing? zope.sqlalchemy seems to work fine with sqlalchemy 0.7 as far as I've seen. WIchert. -- You

Re: [sqlalchemy] I'm missing something with the session...

2011-03-24 Thread Wichert Akkerman
On 3/23/11 23:11 , Hector Blanco wrote: Yeah... the closing thing is because this is going to be in a webserver, and the framework that controls the requests really, really messed up everything (mysql daemon, sqlalchemy...) if the http request was canceled (If I had a user pressing F5 in Firefox

Re: [sqlalchemy] Pypi release policy

2011-02-16 Thread Wichert Akkerman
On 2/16/11 09:20 , Chris Withers wrote: On 15/02/2011 14:27, Eric Lemoine wrote: But aren't apps supposed to use=0.6.99 to avoid backward compats issues? Well, I wish I could just say 0.7 but I guess that would suck in 0.7 betas? Tarek? 0.7dev is the right restriction to use. Wichert.

Re: [sqlalchemy] SQLAlchemy 0.7 beta 1 released

2011-02-15 Thread Wichert Akkerman
Hi Mike, I grabbed SQLAlchemy from pypi when it was still there so I could do a quick test with my current projects (yay for buildout with version pinning). I'm happy to be able to report that the upgrade was seemless, and all my tests were passing with 0.7b1. Wichert. On 2/13/11 01:51 ,

Re: [sqlalchemy] Pypi release policy

2011-02-14 Thread Wichert Akkerman
On 2/14/11 10:57 , M3nt0r3 wrote: Yesterday my life become an hell. :) On saturday ( :O ) SA0.7.b1 is released and easy_install start to use it. The problem is that it broke some installer and doesn't work with my app. That sounds like a bug in your installer, not in SQLAlchemy. Wichert. --

Re: [sqlalchemy] Pypi release policy

2011-02-14 Thread Wichert Akkerman
On 2/14/11 11:25 , M3nt0r3 wrote: My installer for windows download during the process some libs. I use easy_install sqlalchemy and it works. Now too works but 0.7.b1 is not working with the app itself now so it create a lot of problem. I thought that if 0.7.b1 is a beta and brokes API maybe it

Re: [sqlalchemy] Pypi release policy

2011-02-14 Thread Wichert Akkerman
On 2/14/11 11:39 , Tarek Ziadé wrote: On Mon, Feb 14, 2011 at 11:31 AM, Wichert Akkermanwich...@wiggy.net wrote: It sounds like the dependencies in your package are too liberal. I would change your dependency to SQLAlchemy=0.6,0.7dev. That way you can never accidentally install an incompatible

Re: [sqlalchemy] SQLAlchemy 0.6.6 Released

2011-01-09 Thread Wichert Akkerman
Hi Mike, On 1/9/11 00:14 , Michael Bayer wrote: The majority of my time is now spent developing 0.7, which is nearly ready for beta releases pending a few more little features I'd like to try to get in. 0.7 is really exciting with its new event API, lots of other nice touches and of course

Re: [sqlalchemy] SQLAlchemy-Future

2010-12-29 Thread Wichert Akkerman
On 12/28/10 20:54 , Michael Bayer wrote: On Dec 28, 2010, at 2:22 AM, Wichert Akkerman wrote: On 2010-12-28 08:18, Hong Minhee wrote: I don’t know why setuptools provides pkg_resources, implements another incompatible way to declare namespace packages, additionally in spite of existence

Re: [sqlalchemy] SQLAlchemy-Future

2010-12-29 Thread Wichert Akkerman
On 12/29/10 16:45 , Michael Bayer wrote: Yeah this is what I'm seeing, that top level packagenames are used. I.e. I would just say, Use sqlalchemycontrib as your package name, that's what everyone should use. It would appear this approach means nothing needs to happen at all witihin sqlalchemy

Re: [sqlalchemy] SQLAlchemy-Future

2010-12-27 Thread Wichert Akkerman
ImportError: from pkgutil import extend_path __path__ = extend_path(__path__, __name__) I would suggest that SQLAlchemy does the same thing. Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things

[sqlalchemy] rowcount not populated?

2010-10-26 Thread Wichert Akkerman
On an environment using SQLAlchemy 0.6.5 and psycopg 2.2.2 I run the following code: session.execute(Article.__table__.update() .where(Article.retailer_id==self.retailer_id) .where(Article.publish_end=datetime.date.today())

Re: [sqlalchemy] ...kill_hung_threads status...

2010-09-30 Thread Wichert Akkerman
On 9/30/10 16:26 , dobrysmak wrote: Hi guys. I keep getting this message: [paste.httpserver.ThreadPool] kill_hung_threads status: 10 threads (1 working, 9 idle, 0 starting) ave time 0.03sec, max time 0.03sec, killed 0 workers that's just the paste httpserver checking if any of your

Re: [sqlalchemy] forcing an insert

2010-08-03 Thread Wichert Akkerman
On 8/3/10 16:50 , Benjamin Peterson wrote: Is there a way to force the ORM to insert a new row instead of updating? Something like the must_insert argument to model's save method in Django's ORM. The use case is I must create a unique session key (for a cookie) and want an error when the key

Re: [sqlalchemy] Re: open session blocks metadata create_all method

2010-07-29 Thread Wichert Akkerman
On 7/29/10 17:18 , Faheem Mitha wrote: Hi Simon, Thanks. Do you understand why this blocking takes place? I assume by default create_all tries to make a different connection, and fails for some reason? My guess is that it does not fail, but your database is blocking the create_all statements

[sqlalchemy] Creating sequence

2010-04-20 Thread Wichert Akkerman
of generating the statement as well. Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post

Re: [sqlalchemy] Re: joining sessions / two phase commit

2010-02-14 Thread Wichert Akkerman
On 2/14/10 19:02 , Antoine Pitrou wrote: Le dimanche 14 février 2010 à 17:47 +, Chris Withers a écrit : Wichert Akkerman wrote: On 2010-2-9 09:48, Chris Withers wrote: I know that zope's transaction package aims to do just this, I wonder if anyone's used that, or anything else, with SA

Re: [sqlalchemy] Re: joining sessions / two phase commit

2010-02-14 Thread Wichert Akkerman
On 2/14/10 19:54 , Antoine Pitrou wrote: Le dimanche 14 février 2010 à 19:45 +0100, Wichert Akkerman a écrit : That is by design: zope.sqlalchemy (which is really the thing you are complaining about) forces you to commit the entire transaction. This is required to coordinate transactions

Re: [sqlalchemy] getting the actual sql used for a session.execute(sql,subs)

2010-02-11 Thread Wichert Akkerman
not do the substitutions, the DB-API driver does that. So you'll need to look at your database driver to see if that supports logging of commands. You can make postgres log all its commands, perhaps that is an option for you. Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple

Re: [sqlalchemy] Re: joining sessions / two phase commit

2010-02-09 Thread Wichert Akkerman
storage systems. Most commonly using repoze.tm2 to integrate with a WSGI stack, zope.sqlalchemy to integrate SQLAlchemy with transaction and repoze.filesafe to do transaction-safe file creation. Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net

[sqlalchemy] Timezone handling with postgres

2010-01-29 Thread Wichert Akkerman
Postgres can handle timezones fairly well. Using a direct select you can see how it handles daylight saving correctly: test=# select '2010-01-15 12:30 Europe/Amsterdam'::timestamp with time zone, '2010-01-15 12:30 Europe/Amsterdam'::timestamp with time zone + interval '7

Re: [sqlalchemy] Off Topic: Declarative-style for XML?

2009-12-18 Thread Wichert Akkerman
) that are effectively records for groups of simple data types like strings, dates, numbers, etc. lxml with its objectify mode? Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. -- You received

[sqlalchemy] dynamic relation forgets join condition on .count() ?

2009-11-25 Thread Wichert Akkerman
doing something wrong here, or could this be a SQLALchemy bug? If so I can try to boil this down to a failing testcase. Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. -- You received

Re: [sqlalchemy] dynamic relation forgets join condition on .count() ?

2009-11-25 Thread Wichert Akkerman
On 2009-11-25 16:15, Michael Bayer wrote: Wichert Akkerman wrote: I have a data model which has accounts and events, and a many-to-many relation between the two using a CalendarEvent class. It boils down to this: class Account(BaseObject): __tablename__ = account id

[sqlalchemy] Re: Unsupported Type

2009-11-02 Thread Wichert Akkerman
On 11/2/09 14:04 , Sir Rawlins wrote: Hello Guys, I'm getting an exception thrown when trying to save an entity into a SQLite database, this is a database/app which has been ported over from a MySQL backend. The exception looks like this: InterfaceError: (InterfaceError) Error binding

[sqlalchemy] Re: Relation w/ declarative

2009-08-06 Thread Wichert Akkerman
On 8/6/09 09:30 , werner wrote: IIRC correctly the __init__ section is only needed if you want to do: add = Address('an email address') I never do this, i.e. I assign like this add = Address() add.email_address = 'an email address' You can also do this with the default declarative base

[sqlalchemy] missing parenthesis on generated query?

2009-08-05 Thread Wichert Akkerman
. Does this look like a bug, or am I missing something? Wichert. -- Wichert Akkerman wich...@wiggy.net It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ You received this message because you

[sqlalchemy] descriptor design question

2009-05-20 Thread Wichert Akkerman
more complex and expensive. I am hoping someone here has encountered this pattern before and came up with a good solution. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple

[sqlalchemy] Re: Generating INTEGER PRIMARY KEY AUTOINCREMENT column in sqlite

2009-05-19 Thread Wichert Akkerman
are? Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group

[sqlalchemy] Re: Multiple self-referential relations

2009-05-19 Thread Wichert Akkerman
Previously Michael Bayer wrote: On May 18, 2009, at 7:01 AM, Wichert Akkerman wrote: session = orm.relation(SurveySession, cascade=all, remote_side=[SurveySession.id], primaryjoin=SurveySession.id==TreeNode.session_id) parent = orm.relation(TreeNode

[sqlalchemy] Multiple self-referential relations

2009-05-18 Thread Wichert Akkerman
side argument set([sqlalchemy.sql.expression.ColumnClause at 0x1120bd0; TreeNode.id]) I can't seem to figure out what the correct spelling is. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple

[sqlalchemy] bindparams not resolved?

2009-05-11 Thread Wichert Akkerman
argument 'currency' I find it hard to believe parameter binding does not work, since SA uses that internally, but I also can't spot my mistake unfortunately. Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make

[sqlalchemy] Re: Seeing Queries in Postgres

2009-03-04 Thread Wichert Akkerman
configuration settings which you can use to make it log all queries to its logfile. Perhaps that would be useful for you? Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple

[sqlalchemy] Re: What's the use of expunge?

2009-02-26 Thread Wichert Akkerman
Previously Michael Bayer wrote: On Feb 26, 2009, at 8:21 AM, Wichert Akkerman wrote: What happens if you do not call expunge on it, but pickle the object in a cache, load it later and then merge it? the state of the newly unpickled object, that is the current value of its mapped

[sqlalchemy] Re: join_depth in two directions with adjancency lists

2008-12-26 Thread Wichert Akkerman
On 12/25/08 4:37 PM, Michael Bayer wrote: On Dec 25, 2008, at 6:45 AM, Wichert Akkerman wrote: I have a reasonably standard hierarchical datastructure which I'm trying to store in SQL. The basic model looks like this: class Page(BaseObject): __tablename__ = page id

[sqlalchemy] join_depth in two directions with adjancency lists

2008-12-25 Thread Wichert Akkerman
. Is it possible to build that parent list like that? Wichert. -- Wichert Akkerman wich...@wiggy.netIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~-~--~~~---~--~~ You received this message because you