[sqlalchemy] Re: PostgreSQL Tsvector type

2013-12-05 Thread Noufal Ibrahim
Hello Michael, Michael Bayer mike_mp at zzzcomputing.com writes: the TsVector type looks perfect! if you were to package that up for inclusion, it would likely subclass TypeEngine and you’d implement PGTypeCompiler.visit_TSVECTOR.we appear to have a little bit of “tsvector” code

[sqlalchemy] PostgreSQL Tsvector type

2013-12-02 Thread Noufal Ibrahim
Hello everyone, I've been trying to get the postgreSQL tsvector type work with SQLAlchemy without dropping into raw SQL. I was mostly interested in queries and the DDL to create the initial table. Through some trial and error, I have a setup working which I've detailed here

[sqlalchemy] Re: PostgreSQL Tsvector type

2013-12-02 Thread Noufal Ibrahim
Michael Bayer mike_mp at zzzcomputing.com writes: the TsVector type looks perfect! if you were to package that up for inclusion, it would likely subclass TypeEngine and you’d implement PGTypeCompiler.visit_TSVECTOR.we appear to have a little bit of “tsvector” code already (we

[sqlalchemy] Re: Single row of a One to Many query

2009-09-03 Thread Noufal
On Jul 24, 7:19 pm, Michael Bayer mike...@zzzcomputing.com wrote: [..] finding a list of objects and the most recent/highest/somethingest related item requires joining to a subquery, where the subquery selects the func.max(desiredfield) and GROUP BY's the columns that relate the rows to the

[sqlalchemy] Re: Single row of a One to Many query

2009-09-03 Thread Noufal
On Sep 3, 6:15 pm, Mike Conley mconl...@gmail.com wrote: On Thu, Sep 3, 2009 at 8:05 AM, Noufal nou...@gmail.com wrote:    stmt = session.query(Order.table.c.client_id,func.max (Order.table.c.date).label('latest_order')).group_by (Order.table.c.date).subquery() I think your group_by

[sqlalchemy] Single row of a One to Many query

2009-07-24 Thread Noufal
Hello everyone, I've been using sqlalchemy with elixir for a legacy project for a while now and recently needed to write some more than trivial queries. I have the default elixir generated mappers but using only them forces me to do some data processing in my app rather than in the database.

[sqlalchemy] mySQL and timedelta

2007-10-01 Thread Noufal
Hello everyone, I'm having some trouble with a query involving a timedelta object with a mySQL backend (MyISAM). I have a table called Run that has two fields like so. sa.Column('starttime', sa.TIMESTAMP), sa.Column('endtime', sa.TIMESTAMP) I'm trying to find all rows that have endtime -

[sqlalchemy] Re: Auto load problem with SQLAlchemy 0.3.10 and mySQL

2007-09-21 Thread Noufal
The MyISAM storage engine doesn't retain foreign key information- to autoload FKs you must create the table with a storage engine that supports FKs such as InnoDB. That looks like: Table('stats', metadata, ..columns.., mysql_engine='InnodB') You can also use ALTER TABLE via mysql to

[sqlalchemy] Re: Auto load problem with SQLAlchemy 0.3.10 and mySQL

2007-09-20 Thread Noufal
Did you originally create the tables through SQLAlchemy or are you reflecting an existing schema? In either case I'd need to see the output of SHOW CREATE TABLES for the problem table to make a diagnosis. I create the tables using SQLAlchemy. I'll send you the output in a day, I'm away

[sqlalchemy] Re: Auto load problem with SQLAlchemy 0.3.10 and mySQL

2007-09-20 Thread Noufal
On Sep 20, 10:34 pm, Noufal [EMAIL PROTECTED] wrote: [..] I create the tables using SQLAlchemy. I'll send you the output in a day, I'm away from the machine where this code is right now. The output of the create table column looks like this CREATE TABLE `stats` ( `sid` int(11) NOT NULL