Re: [sqlalchemy] use "USING ( join_column [, ...] )" instead of "ON join_condition"

2012-11-08 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Il 08/11/2012 00:32, Michael Bayer ha scritto: > > On Nov 7, 2012, at 6:18 PM, Manlio Perillo wrote: > >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 > >> Hi. > >> When selecting against joined t

[sqlalchemy] use "USING ( join_column [, ...] )" instead of "ON join_condition"

2012-11-07 Thread Manlio Perillo
isouter=False): ... When specified ``using`' take precedence over `onclause`. Thanks Manlio Perillo -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAlCa7CwACgkQscQJ24LbaUQeyQCeIqMJyemQ

Re: [sqlalchemy] best practice to create an engine in a test suite

2012-04-13 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Il 13/04/2012 18:59, Michael Bayer ha scritto: > > On Apr 13, 2012, at 12:08 PM, Manlio Perillo wrote: > >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 > >> Hi. > >> What is the best practice to create

Re: [sqlalchemy] possible bug about new Engine transaction's context manager

2012-04-13 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Il 12/04/2012 20:45, Michael Bayer ha scritto: > [...] >> I have another question, about coding style. >> Current SQLAlchemy code create the connection and transaction objects in >> the Engine.begin method, and then return an instance of >> Engine._tra

[sqlalchemy] best practice to create an engine in a test suite

2012-04-13 Thread Manlio Perillo
rn create_engine(url) ## end __init__.py Thanks Manlio Perillo -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk+IT48ACgkQscQJ24LbaUQYsQCfe9MSsb+/1yk+c+3HzdQUcxZz xh0An2FU6CCQ3TJ8OsjN7GLGecRygnTq =Gzwa

[sqlalchemy] possible bug about new Engine transaction's context manager

2012-04-12 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. I looked at SQLAlchemy source code to see examples about `with` statement support and found something that look suspicious to me. class Engine: def begin(self, close_with_result=False) conn = self.contextual_connect(

Re: [sqlalchemy] Postgresql COPY

2011-04-15 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Il 15/04/2011 09:17, Yang Zhang ha scritto: > Is it possible to execute a Postegresql COPY ... FROM STDIN statement > via sqlalchemy, or do we have to drop down to psycopg2 for that > (http://initd.org/psycopg/docs/usage.html#using-copy-to-and-copy-fro

Re: [sqlalchemy] reusing the SQLAlchemy nose plugin

2010-05-21 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > [...] >> A precisation. >> >> The reason I used the sa_only flag is because I assumed there was a >> reason why test cases not derived from testing.TestBase must be ignored. >> >> If possible, the wantMethod should be someth

Re: [sqlalchemy] Re: Alembic

2010-05-21 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > [...] >> To clarify; Alembic supports branching, Migrate doesn't? >> (and where can I find out exactly what is meant by branching?) > > it means if you have a branch of the repo, so say you start with source A > with versi

Re: [sqlalchemy] reusing the SQLAlchemy nose plugin

2010-05-21 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > [...] >> Is is possible to modify the SQLAlchemy nose plugin in order to be more >> cooperative? >> As an example by adding an option that will change the wantClass method from >> >> if not issubclass(cls, testing.TestBase)

Re: [sqlalchemy] reusing the SQLAlchemy nose plugin

2010-05-21 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > [...] >> >> Is is possible to modify the SQLAlchemy nose plugin in order to be more >> cooperative? >> As an example by adding an option that will change the wantClass method from >> >> if not issubclass(cls, testing.TestBa

[sqlalchemy] reusing the SQLAlchemy nose plugin

2010-05-21 Thread Manlio Perillo
Hi. In a project using SQLAlchemy I decided to use the SQL nose plugin, in order to avoid reinventing the wheel. Unfortunately it seems the plugin is a bit too invasive and it will only work with SQLAlchemy test suite. The problem is with the wantClass method, that pratically will ignore all nor

Re: [sqlalchemy] SQLAlchemy 0.6beta2 released

2010-03-21 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > SQLAlchemy 0.6beta2 is now available.This beta may be the last before the > 0.6.0 final release. We've hopefully gotten every largish change into the > release as possible so that people can test. 0.6 is already ru

Re: [sqlalchemy] using in_ against multiple columns

2010-03-16 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 richard reitmeyer ha scritto: > Hello, all. > > I'm trying to use compound fields with in_ to achieve something like > this: > > update foo set svrid = NULL, asof=NULL > where (svrid,asof) > in (select svrid, asof from foo except se

Re: [sqlalchemy] SQLAlchemy 0.6beta1: PG dialect: DropTable: (ProgrammingError) syntax error at or near "CONSTRAINTS"

2010-03-11 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gerry Reno ha scritto: > Been doing great with SQLAlchemy 0.6beta1 for the past week after a > couple snags migrating from 5.5. > > Today I hit a small problem with postgresql on DropTables: > > running this command: > engine.execute(DropTabl

[sqlalchemy] update_or_insert

2010-03-07 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. I have the following use case: a table that contains the layout info of some elements in a web page. The layout is fixed, that is, the number and the positions of the elements that can be displayed is fixed. This means that in order to change the

Re: [sqlalchemy] Re: [PROPOSE] Integrate migration support in SQLAlchemy

2010-03-05 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Lele Gaifax ha scritto: > Manlio Perillo writes: > >> Michael Bayer ha scritto: >>> Similarly, the concept of a "version" as an integer number is not really >>> flexible enough - >> The idea was to keep

Re: [sqlalchemy] [PROPOSE] Integrate migration support in SQLAlchemy

2010-03-04 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > I'm pretty much -1 on this since I think migrations need to have absolute > flexibility - the "listener" system within create_all() is not at all > designed to be used to that degree. Another solution is to add a complete

[sqlalchemy] [PROPOSE] Integrate migration support in SQLAlchemy

2010-03-04 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. I would like to implement a minimal but working support to migrations in SQLAlchemy. I know there is already sqlalchemy-migration, but the code is not integrated in SQLAlchemy, and it is less flexible. A detailed description of the propose is he

[sqlalchemy] extended use of VALUES command

2010-03-02 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. Is it possible, in SQLAlchemy, to express this query? CREATE TEMP TABLE foo ( x INTEGER, y INTEGER ); INSERT INTO foo VALUES (10, 11); INSERT INTO foo VALUES (1, 2); manlio=> SELECT * FROM foo WHERE (x, y) in (VALUES (1, 2), (3, 4)); x

[sqlalchemy] suspicious code in PostgreSQL ENUM handling

2010-03-01 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. I find this code (sqlalchemy.dialects.postgresql.base) suspicious: class ENUM(sqltypes.Enum): def create(self, bind=None, checkfirst=True): if not checkfirst or not bind.dialect.has_type(bind, self.name, schema=self.schema):

Re: [sqlalchemy] failures in the test suite for match operator in PostgreSQL 8.4

2010-03-01 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > On Feb 28, 2010, at 4:32 PM, Manlio Perillo wrote: > >> By the way, I have also noted that in the SQLAlchemy source code there >> are many extra whitespaces (lines with only whitespaces, or lines ending &

Re: [sqlalchemy] copyright on submitted patches

2010-03-01 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > Manlio Perillo wrote: > Hi. > > What is the copyright policy on patches submitted on the SQLAlchemy bug > tracker? > > I'm glad to release them under the MIT license (it is the licence I use >

Re: [sqlalchemy] some question about SQLAlchemu development

2010-03-01 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > [...] > I'm not sure, however, if `test_schema` method test should go in > `test/engine/test_reflection.py`, since it is not directly related to > reflection. > > With the old patch > (http://www.sqlalchemy.org/trac/attachm

Re: [sqlalchemy] some question about SQLAlchemu development

2010-03-01 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > [...] > I'm not sure, however, if `test_schema` method test should go in > `test/engine/test_reflection.py`, since it is not directly related to > reflection. > > With the old patch > (http://www.sqlalchemy.org/trac/attachm

[sqlalchemy] copyright on submitted patches

2010-03-01 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. What is the copyright policy on patches submitted on the SQLAlchemy bug tracker? I'm glad to release them under the MIT license (it is the licence I use for my own projects) but the "problem" is that the patch author des not appear anywhere. It

Re: [sqlalchemy] some question about SQLAlchemu development

2010-03-01 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > On Feb 28, 2010, at 8:12 PM, Manlio Perillo wrote: > > Michael Bayer ha scritto: >>>> [...] >>>> * I have noted that some database objects not directly attached to a >>>> meta

Re: [sqlalchemy] failures in the test suite for match operator in PostgreSQL 8.4

2010-03-01 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > On Feb 28, 2010, at 8:01 PM, Manlio Perillo wrote: > > Rami Chowdhury ha scritto: >>>> On Feb 28, 2010, at 15:17 , Manlio Perillo wrote: >>>> >>>> Rami Chowdhury ha scritto

Re: [sqlalchemy] some question about SQLAlchemu development

2010-02-28 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > [...] > * I have noted that some database objects not directly attached to a > metadata, like a Sequence, can leave the database in an inconsistent > state if the associated test suite fails. > > I have the same problem

Re: [sqlalchemy] bug in DROP TABLE CASCADE

2010-02-28 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > On Feb 28, 2010, at 3:21 PM, Manlio Perillo wrote: > > When reading the code in the `sql.compiler` module, I noted this: > >def visit_drop_table(self, drop): >ret = "\nDROP TABLE "

Re: [sqlalchemy] failures in the test suite for match operator in PostgreSQL 8.4

2010-02-28 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Rami Chowdhury ha scritto: > On Feb 28, 2010, at 15:17 , Manlio Perillo wrote: > > Rami Chowdhury ha scritto: >>>> On Sunday 28 February 2010 13:32:40 Manlio Perillo wrote: >>>> I have found that some tests fails:

[sqlalchemy] incorrect behaviour with primary key constraint and integer columns

2010-02-28 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I think that SQLAlchemy behaves incorrectly when there is a primary key constraint on multiple columns and one of the columns is of type Integer. ## from sqlalchemy import schema, types, create_engine metadata = schema.MetaData() test = schema.Table

Re: [sqlalchemy] ticket #877

2010-02-28 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > > Done, new patch attached. > The is also a bug fix: I forgot to clear the notices list. > The notices list is cleared *only* if messages are actually logged. > > I took the liberty to change the coding style, too. > > If

Re: [sqlalchemy] failures in the test suite for match operator in PostgreSQL 8.4

2010-02-28 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Rami Chowdhury ha scritto: > On Sunday 28 February 2010 13:32:40 Manlio Perillo wrote: > I have found that some tests fails: > http://paste.pocoo.org/show/184048/ > >> Are you using the latest SVN? I'm using the mercurial

[sqlalchemy] some question about SQLAlchemu development

2010-02-28 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. I recently wrote my first big patch for SQLAlchemy: http://www.sqlalchemy.org/trac/attachment/ticket/1679/schema.patch and I have some questions about the source code. * Why objects like Sequence have a `__visit_name__ = 'sequence'`, and the `

[sqlalchemy] failures in the test suite for match operator in PostgreSQL 8.4

2010-02-28 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I have found that some tests fails: http://paste.pocoo.org/show/184048/ The problem is with the match operarator for fulltext search. I'm using PostgreSQL 8.4. By the way, I have also noted that in the SQLAlchemy source code there are many extra wh

[sqlalchemy] bug in DROP TABLE CASCADE

2010-02-28 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 When reading the code in the `sql.compiler` module, I noted this: def visit_drop_table(self, drop): ret = "\nDROP TABLE " + self.preparer.format_table(drop.element) if drop.cascade: ret += " CASCADE CONSTRAINTS"

Re: [sqlalchemy] ticket #877

2010-02-28 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > On Feb 28, 2010, at 11:21 AM, Manlio Perillo wrote: > > I would like to write a patch for ticket #877. > Sorry, I forgot to update the log level used in the patch (I was doing some tests with the engine `ech

Re: [sqlalchemy] ticket #877

2010-02-28 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > On Feb 28, 2010, at 11:21 AM, Manlio Perillo wrote: > > I would like to write a patch for ticket #877. > > What is the best method to implement the requested feature? > > The ExecutionContext class h

[sqlalchemy] ticket #877

2010-02-28 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I would like to write a patch for ticket #877. What is the best method to implement the requested feature? The ExecutionContext class has a post_exec method, so the implementation for the psycopg2 driver can override this method, check for the notice

Re: [sqlalchemy] bug: changeset b89c179b0daf and user defined types

2010-02-26 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > we no longer make the assumption that the right side of an expression is the > same type as that of the left (since it is not true in many cases). So you > must coerce manually: > > literal('programming-lang', LabelTree)

[sqlalchemy] bug: changeset b89c179b0daf and user defined types

2010-02-26 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. It seems that changeset b89c179b0daf (from Mercurial repository) broke user defined types handling. Here is a program that reproduces the problem: http://paste.pocoo.org/show/183084/ Here is the output of the program: http://paste.pocoo.org/show/

Re: [sqlalchemy] another problem with complex join

2010-02-23 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > > On Feb 18, 2010, at 11:55 AM, Manlio Perillo wrote: > > Michael Bayer ha scritto: >>>> [...] >>>>> so what I had in mind is that, if its given a join as the left side, >>>

Re: [sqlalchemy] another problem with complex join

2010-02-20 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ben De Luca ha scritto: > >> Ok, thanks. >> I have never seen this pattern in use. >> If the import is done inside a function, usually there are no problems >> with circular module import. > > Its a performance gain as the second time you hit that fu

Re: [sqlalchemy] another problem with complex join

2010-02-19 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > [...] > Since we are speaking about _match_primaries, I'm curious to know why > the implementation is: > > def _match_primaries(self, primary, secondary): >global sql_util >if not sql_util: >from sqlalchemy.

Re: [sqlalchemy] another problem with complex join

2010-02-18 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > [...] >> so what I had in mind is that, if its given a join as the left side, >> it just does the "natural" thing, i.e. joins to the right. >> If the "natural" join isn't available, then it does its usual >> search through

Re: [sqlalchemy] inner join and ambiguous columns

2010-02-18 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > > On Feb 18, 2010, at 10:18 AM, Michael Bayer wrote: > >>> >>> Ok. >>> My idea was to implement the equivalent of SQL '*' column. >>> I can't use the literal '*' in the select column list, since it will >>> disable (?) SQL

Re: [sqlalchemy] How to search a particular hour?

2010-02-18 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ning ha scritto: > Hi all, > > Anyone have any ideal how to search a particular hour. > > usually we can use datepart function in sql. > > for example > > datepart(hour, datetime) in (7,8) > > But it is not really working in sqlalchemy > > I trie

Re: [sqlalchemy] inner join and ambiguous columns

2010-02-18 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > On Feb 17, 2010, at 9:56 AM, Manlio Perillo wrote: > > Michael Bayer ha scritto: >>>> [...] >>>> By the way, I have found an incorrect behaviour in SQLAlchemy, when the >>>>

Re: [sqlalchemy] another problem with complex join

2010-02-17 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > On Feb 17, 2010, at 9:19 AM, Manlio Perillo wrote: > > Hi. > > I have found another limitation of SQLAlchemy, when handling joins. > The code is here: > http://paste.pocoo.org/sh

Re: [sqlalchemy] inner join and ambiguous columns

2010-02-17 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > [...] > By the way, I have found an incorrect behaviour in SQLAlchemy, when the > select column list is empty. > > query = sql.select( > None, contents.c.slug == 'python', from_obj=[join]) > > > SQLAlchemy generates an

[sqlalchemy] another problem with complex join

2010-02-17 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. I have found another limitation of SQLAlchemy, when handling joins. The code is here: http://paste.pocoo.org/show/179286/ I get: sqlalchemy.exc.ArgumentError: Can't determine join between 'Join object on Join object on content_types(159586732) an

Re: [sqlalchemy] inner join and ambiguous columns

2010-02-17 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > On Feb 16, 2010, at 7:07 PM, Manlio Perillo wrote: > > Michael Bayer ha scritto: >>>> [...] >>>>> just so I can understand fully can you modify the paste I sent to >>>>> i

Re: [sqlalchemy] inner join and ambiguous columns

2010-02-16 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > [...] >> just so I can understand fully can you modify the paste I sent to >> illustrate exactly how the results are happening, as that can help me to >> formulate the best version of this feature. > I have pasted a comple

Re: [sqlalchemy] inner join and ambiguous columns

2010-02-16 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > Manlio Perillo wrote: > Here is the code I have: > http://paste.pocoo.org/show/178959/ > > What each plugin do is: > - add additional columns in the select list > - add additional where clauses or ord

Re: [sqlalchemy] inner join and ambiguous columns

2010-02-16 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > [...] > Unfortunately, fold_equivalents is not a generic solution for me > I have a generative query, where I later add the select_from object. > > The query is generative, since the tables involved are not know in > advanc

Re: [sqlalchemy] inner join and ambiguous columns

2010-02-16 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > Manlio Perillo wrote: > [...] > query = sql.join(x, y).select() > r = engine.execute(query).fetchone() > [...] > > This code will raise an: > sqlalchemy.exc.InvalidRequestError: Ambiguous co

[sqlalchemy] inner join and ambiguous columns

2010-02-16 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. Here is a simple example of using joins in SQLAlchemy: from sqlalchemy import schema, types, sql, create_engine metadata = schema.MetaData() x = schema.Table( 'x', metadata, schema.Column('id', types.Integer, primary_key=True), schem

Re: [sqlalchemy] suggestions about SQL SCHEMA handling in SQLAlchemy

2010-02-09 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > Manlio Perillo wrote: >> PoolListener is rather low level; if I use them I need to know in >> advance the secondary databases to attach. > > What precisely is the use case for an application that wi

Re: [sqlalchemy] suggestions about SQL SCHEMA handling in SQLAlchemy

2010-02-09 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > Manlio Perillo wrote: >> When writing this code I found some problems with SQLAlchemy: >> >> 1) There is no support for SQL Schema at all. >> >>It is ok, for me, if there is no

Re: [sqlalchemy] draft SQL schema support in SQLAlchemy

2010-02-09 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > Manlio Perillo wrote: > Hi. > > I have written a module to implement support to SQL Schema in SQLALchemy. > > The code is available here: > http://paste.pocoo.org/show/17/ > > It

[sqlalchemy] draft SQL schema support in SQLAlchemy

2010-02-08 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. I have written a module to implement support to SQL Schema in SQLALchemy. The code is available here: http://paste.pocoo.org/show/17/ It requires this patch: http://paste.pocoo.org/show/175556/ It currently supports PostgreSQL and SQLite.

Re: [sqlalchemy] suggestions about SQL SCHEMA handling in SQLAlchemy

2010-02-08 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > Manlio Perillo wrote: > Hi. > > I would like to use SQL schemas in my projects, however support in > SQLAlchemy is quite poor. > > What I want to do is to create a custom MetaData object, that allow

[sqlalchemy] urlencoding SQLAlchemy queries

2010-02-03 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. I would like to have a function, that given an SQLAlchemy select query, an urlencoded string and some other parameters, add the encoded query parameters to the query, using the generative where method. Something like what Django does. I'm going

Re: [sqlalchemy] insert with scalar select statament

2010-02-02 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > Manlio Perillo wrote: > [...] >>>> OK you mean SQL expression during compilation. This is ticket #1534 >>>> which is not yet implemented. >> >> After some tests I got something

Re: [sqlalchemy] insert with scalar select statament

2010-02-02 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > [...] > In SQL (tested with PostgreSQL and SQLite, at least) I can do: > INSERT INTO test (text) values(to_tsvector('some text')); > > That is, it is possible to specify a scalar select statement for each > value. > > > I

[sqlalchemy] insert with scalar select statament

2010-02-02 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. I have written a small class in order to support PostgreSQL tsearch type: class TextSearchVector(UserDefinedType): """Support for full-text search See http://www.postgresql.org/docs/8.4/static/datatype-textsearch.html """ de

Re: [sqlalchemy] UserDefinedType and result_processor

2010-02-02 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > On Feb 1, 2010, at 8:31 PM, Manlio Perillo wrote: > > Hi. > > I have defined a custom type for PostgreSQL ltree support. > > [...] > This works, when I create the table and insert some values.

[sqlalchemy] UserDefinedType and result_processor

2010-02-01 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. I have defined a custom type for PostgreSQL ltree support. The code is very simple (I'm using version from trunk): class LabelTree(UserDefinedType): def bind_processor(self, dialect): def process(value): assert '_' not in

Re: [sqlalchemy] syntax error in a multi INSERT statement

2010-02-01 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > Manlio Perillo wrote: > Hi. > > I'm experiencing a strange problem with a multi INSERT statement. > > Strange because I'm unable to reproduce it. > > Here are both SQLAlchemy

[sqlalchemy] suggestions about SQL SCHEMA handling in SQLAlchemy

2010-02-01 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. I would like to use SQL schemas in my projects, however support in SQLAlchemy is quite poor. What I want to do is to create a custom MetaData object, that allows me to specify the default schema name to use. All tables bound to that meta data, w

[sqlalchemy] syntax error in a multi INSERT statement

2010-02-01 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. I'm experiencing a strange problem with a multi INSERT statement. Strange because I'm unable to reproduce it. Here are both SQLAlchemy (trunk) and PostgreSQL (8.3) logs: sqlalchemy.exc.ProgrammingError: (ProgrammingError) syntax error at positi

Re: [sqlalchemy] problem when executing multiple insert statements and boolean type

2010-01-29 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 King Simon-NFHD78 ha scritto: > [...] >> params = [ {'x': 1}, {'x': 2, 'y': False} ] >> engine.execute(test.insert(), params) >> print engine.execute(test.select()).fetchall() > [...] >> >> This should print: >> [(1, True), (2, False)] >>

[sqlalchemy] problem when executing multiple insert statements and boolean type

2010-01-29 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. I'm here again with a problem I don't know if it is a bug in SA or in my code. Here is the offending code: from sqlalchemy import schema, types, sql, create_engine metadata = schema.MetaData() test = schema.Table( 'test', metadata, sch

Re: [sqlalchemy] possible bug with SQL CASE

2010-01-28 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > Manlio Perillo wrote: >> However, now I'm not sure to understand the example here: >> http://www.sqlalchemy.org/docs/reference/sqlalchemy/expressions.html?highlight=exists#sqlalchemy.sql.expression.exis

Re: [sqlalchemy] possible bug with SQL CASE

2010-01-28 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > [...] > from sqlalchemy import schema, types, sql, create_engine > > metadata = schema.MetaData() > test = schema.Table( > 'test', metadata, > schema.Column('x', types.Integer, primary_key=True) > ) > > engine

[sqlalchemy] possible bug with SQL CASE

2010-01-28 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. It seems there is a bug with SQL CASE support in SQLAlchemy (I'm testing using trunk). Here is the original SQL statements: CREATE TABLE test ( x INTEGER PRIMARY KEY ); SELECT CASE WHEN 'true' THEN (SELECT EXISTS (SELECT x FROM test))

[sqlalchemy] error handling for sessionmaker function

2010-01-11 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. I'm updating some of my code to SQLALchemy 0.6, and I have noted a problem with the sessionmaker function. The problem is a compatibility one: old versions use the transactional parameter, new ones the autocommit parameter. Usually, to handle th

[sqlalchemy] postgresql DELETE...RETURNING

2009-10-21 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. I have noted that SQLAlchemy supports PostgreSQL 8.3 INSERT/UPDATE...RETURNING, but not DELETE... RETURNING. What is the reason? Thanks Manlio Perillo -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG

[sqlalchemy] Re: problems with pickle and RowProxy

2009-10-12 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > > On Oct 11, 2009, at 12:59 PM, Manlio Perillo wrote: > >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> Michael Bayer ha scritto: >>> [...] >>> BufferedCol

[sqlalchemy] Re: problems with pickle and RowProxy

2009-10-11 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > [...] > BufferedColumnRow is also not picklable. The reference to the parent > ResultProxy is still required which itself is not picklable. > [...] > > In any case this feature request would only be for 0.6. Ok, tha

[sqlalchemy] Re: problems with pickle and RowProxy

2009-10-11 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: > > On Oct 11, 2009, at 8:06 AM, Manlio Perillo wrote: > > Hi. > > I have noted a problem when a I try to pickle an instance of > sqlalchemy.engine.base.RowProxy: > > <...> > File &quo

[sqlalchemy] problems with pickle and RowProxy

2009-10-11 Thread Manlio Perillo
_reg.py", line 76, in _reduce_ex raise TypeError("a class that defines __slots__ without " TypeError: a class that defines __slots__ without defining __getstate__ cannot be pickled Is this limitation really necessary? Thanks Manlio Perillo -BEGIN PGP SIGNATURE- Version: GnuP

[sqlalchemy] PostgreSQL: subqueries and alias

2009-05-06 Thread Manlio Perillo
query')]) However IMHO this should be done by SQLALchemy, and not by the programmer. What do you think? Thanks Manlio Perillo -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkoByRkACgkQscQJ24LbaUQz

[sqlalchemy] integration of SQLAlchemy in a WSI environ

2008-07-19 Thread Manlio Perillo
dbapi/test_dbapi.py I would really appreciate comments about the code. Thanks Manlio Perillo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send emai

[sqlalchemy] OperationalError: (OperationalError) cannot commit transaction - SQL statements in progress

2008-07-16 Thread Manlio Perillo
ddress, contacts_info WHERE contacts_info.username = ? ['[EMAIL PROTECTED]'] COMMIT BEGIN UPDATE contacts_info SET full_name=?, telephone=?, fiscal_code=? WHERE contacts_info.username = ? ['Manlio Perillo x', u'B', u'C', '[EMAIL PROTECTED]'] UPDATE contact

[sqlalchemy] Re: integrating SQLAlchemy in a WSGI based framework

2008-07-09 Thread Manlio Perillo
Michael Bayer ha scritto: > > On Jul 8, 2008, at 2:50 PM, Manlio Perillo wrote: > >> Michael Bayer ha scritto: >>> [...] >>> >>> Current integration approaches focus on the scoped_session() >>> construct >>> as "home base&

[sqlalchemy] Re: integrating SQLAlchemy in a WSGI based framework

2008-07-08 Thread Manlio Perillo
r each transaction (if the user does not like it, then it can use its how logic). My problem is with contextual connections. Thanks Manlio Perillo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalch

[sqlalchemy] Re: integrating SQLAlchemy in a WSGI based framework

2008-07-08 Thread Manlio Perillo
is sized appropriately otherwise > your whole app could freeze if an async request blocks on no > connections available. > If no connections are available, then an exception should be raised. Thanks Manlio Perillo --~--~-~--~~~---~--~~ You recei

[sqlalchemy] integrating SQLAlchemy in a WSGI based framework

2008-07-08 Thread Manlio Perillo
nup of the contextual connection at the end of the request. My question is: will this suffice or should I implement something more integrated with SQLAlchemy? Another problem is with the ORM, but I'm still studing it since a lot has changed sin

[sqlalchemy] sessions and transactions

2008-07-08 Thread Manlio Perillo
Hi. Is it ok to do something like: def helper(conn): sess = orm.create_session(bind=conn) t = Test() t.x = 121 sess.save(t) sess.flush() sess.close() db = create_engine(URL) db.transaction(db, helper) ? Thanks Manlio Perillo

[sqlalchemy] Re: problem with SHOW command

2008-07-07 Thread Manlio Perillo
Glauco ha scritto: > Manlio Perillo ha scritto: >> Hi. >> >> I'm having strange problems when I execute a SHOW command with PostgreSQL. >> >> from sqlalchemy import create_engine, sql, __version__ >> >> print __version__ >> >> URL = &#

[sqlalchemy] problem with SHOW command

2008-07-07 Thread Manlio Perillo
hemy.exceptions.InterfaceError: (InterfaceError) cursor already closed None None What's the problem? If I execute the query directly with psycopg2, there are no errors. Thanks Manlio Perillo --~--~-~--~~~---~--~~ You received this message because you are

[sqlalchemy] insert into select from

2008-02-17 Thread Manlio Perillo
Hi. Does sqlalchemy supports the query in the subject? Thanks Manlio Perillo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@google

[sqlalchemy] Re: foreign key support in SQLite

2008-01-28 Thread Manlio Perillo
Michael Bayer ha scritto: > > On Jan 28, 2008, at 6:03 AM, Manlio Perillo wrote: > >> Hi. >> >> In this wiki page: >> http://www.sqlite.org/cvstrac/wiki?p=ForeignKeyTriggers >> >> there is a recipe on how to add basic foreign key support to SQLi

[sqlalchemy] Re: foreign key support in SQLite

2008-01-28 Thread Manlio Perillo
27; in SQLAlchemy? > Unstable internal API. > Kindest regards, > > Koen Bok > Manlio Perillo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send

[sqlalchemy] foreign key support in SQLite

2008-01-28 Thread Manlio Perillo
in SQLAlchemy (so that they can be automatically created/dropped) but I have abandoned the project because the internals of SQLAlchemy are unstable. Thanks Manlio Perillo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

[sqlalchemy] Re: Asynchronous SQLAlchemy

2008-01-27 Thread Manlio Perillo
es from SQLAlchemy internals; moreover the code is very simple so it should be easy to fix any problems. A possible problem can be with compiled query execution. Regards Manlio Perillo --~--~-~--~~~---~--~~ You received this message because you are subscr

[sqlalchemy] Re: sqlalchemy and postgresql warning messages

2007-11-21 Thread Manlio Perillo
Michael Bayer ha scritto: > > On Nov 20, 2007, at 4:35 AM, Manlio Perillo wrote: > >> I have asked on the psycopg2 list. >> >> psycopg2 connection has a notices attribute. >> >> >> try: >> conn = db.connect() &g

[sqlalchemy] Re: sqlalchemy and postgresql warning messages

2007-11-20 Thread Manlio Perillo
Michael Bayer ha scritto: > > On Nov 16, 2007, at 1:54 PM, Manlio Perillo wrote: > >> There is an error in the schema, b.id is of type String instead of >> type >> Integer. >> >> Unfortunately PostgreSQL does not raises an error, but just a warning. &g

  1   2   >