Sam's Lists | 1 Mar 20:07
Picon
Gravatar

Selects with a timedelta...

Hi...

I'm sure I should know this but I don't.

I'd like to do a select using a timedelta.  I.e. I'd like one of the parameters to be that it was updated in the last week.

Here's what I have so far:

  timed = timedelta(days=7)
  rrunning = list(RRun.select(AND(RRun.q.progressID == 1,
                                                  RRun.q.pingTime < timed)))

But it doesn't work.  Any idea as to how to go about this?

Thank you everyone for your continued help!




-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Picon

Re: Selects with a timedelta...

On Saturday 01 March 2008 13:07:38 Sam's Lists wrote:
> I'd like to do a select using a timedelta.  I.e. I'd like one of the
> parameters to be that it was updated in the last week.

Here's the way I'd do it:
cutoff = datetime.datetime.now() - datetime.timedelta(days=7)
rrunning = list(RRun.select(AND(RRun.q.progressID == 1,
                                                  RRun.q.pingTime >cutoff)))

cs

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Oleg Broytmann | 3 Mar 17:48
X-Face
Picon
Favicon

SQLObject 0.9.4

Hello!

I'm pleased to announce the 0.9.4 release of SQLObject.

What is SQLObject
=================

SQLObject is an object-relational mapper.  Your database tables are described
as classes, and rows are instances of those classes.  SQLObject is meant to be
easy to use and quick to get started with.

SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite, and
Firebird.  It also has newly added support for Sybase, MSSQL and MaxDB (also
known as SAPDB).

Where is SQLObject
==================

Site:
http://sqlobject.org

Development:
http://sqlobject.org/devel/

Mailing list:
https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss

Archives:
http://news.gmane.org/gmane.comp.python.sqlobject

Download:
http://cheeseshop.python.org/pypi/SQLObject/0.9.4

News and changes:
http://sqlobject.org/News.html

What's New
==========

News since 0.9.3
----------------

Bug Fixes
~~~~~~~~~

* Use list.reverse() in manager/command.py for Python 2.2 compatibility.

* Prevent MultipleJoin from removing the intermediate table if it was not
  created by the Join.

* Fixed a bug with no default when defaultSQL is defined for the column.

* Recognize POINT data type as string in PostgresConnection.columnsFromSchema().

For a more complete list, please see the news:
http://sqlobject.org/News.html

Oleg.
--

-- 
     Oleg Broytmann            http://phd.pp.ru/            phd <at> phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Oleg Broytmann | 3 Mar 18:03
X-Face
Picon
Favicon

SQLObject 0.10.0b4

Hello!

I'm pleased to announce the 0.10.0b4, the fourth (and perhaps the last)
beta release of SQLObject.

What is SQLObject
=================

SQLObject is an object-relational mapper.  Your database tables are described
as classes, and rows are instances of those classes.  SQLObject is meant to be
easy to use and quick to get started with.

SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite, and
Firebird.  It also has newly added support for Sybase, MSSQL and MaxDB (also
known as SAPDB).

Where is SQLObject
==================

Site:
http://sqlobject.org

Development:
http://sqlobject.org/devel/

Mailing list:
https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss

Archives:
http://news.gmane.org/gmane.comp.python.sqlobject

Download:
http://cheeseshop.python.org/pypi/SQLObject/0.10.0b4

News and changes:
http://sqlobject.org/News.html

What's New
==========

News since 0.10.0b3
----------------

* Use sets instead of dicts in tablesUsed. Dropped tablesUsedDict function;
  instead there is tablesUsedSet that returns a set of strings.

* Fixed a bug with no default when defaultSQL is defined for the column.

* Recognize POINT data type as string in PostgresConnection.columnsFromSchema().

For a more complete list, please see the news:
http://sqlobject.org/News.html

Oleg.
--

-- 
     Oleg Broytmann            http://phd.pp.ru/            phd <at> phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Sam's Lists | 3 Mar 19:43
Picon
Gravatar

Re: Selects with a timedelta...

Works great.  Thank you!!

On Sat, Mar 1, 2008 at 7:15 PM, Christopher Singley <csingley <at> gmail.com> wrote:
On Saturday 01 March 2008 13:07:38 Sam's Lists wrote:
> I'd like to do a select using a timedelta.  I.e. I'd like one of the
> parameters to be that it was updated in the last week.

Here's the way I'd do it:
cutoff = datetime.datetime.now() - datetime.timedelta(days=7)
rrunning = list(RRun.select(AND(RRun.q.progressID == 1,
                                                  RRun.q.pingTime >cutoff)))


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Kevin J. Rice | 3 Mar 22:10

Extra select count(*) being run for no apparent reason ...


Hello:

Through sql query debug flag, I've found the statement:

y = list(MySObjectThing.select().limit(1))

generates:

1. select field1, field2,... from mysqlobjectthing where 1 = 1 limit 1
2. select count(*) from mysqlobjectthing;

The second call is superfluous, silly, and in large tables, quite time consuming.

Any ideas why it happens?

Is this a known bug, or a fixed bug, or is it a subtle 'feature' I didn't know I might hate having to want?

Thanks,
-- Kevin

___________________________________
Kevin J. Rice
Senior Software Engineer, Textura Corporation
51-K Sherwood Terrace, Lake Bluff IL 
___________________________________


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Oleg Broytmann | 3 Mar 22:32
X-Face
Picon
Favicon

Re: Extra select count(*) being run for no apparent reason ...

On Mon, Mar 03, 2008 at 03:10:33PM -0600, Kevin J. Rice wrote:
> y = list(MySObjectThing.select().limit(1))
> 
> generates:
> 
> 1. select field1, field2,... from mysqlobjectthing where 1 = 1 limit 1
> 2. select count(*) from mysqlobjectthing;

   In what SQLObject version? For 0.9.3 with SQLite there is only one
query:

from sqlobject import *
from sqlobject.sqlbuilder import *

__connection__ = "sqlite:/:memory:?debug=1"

class Test(SQLObject):
   name = StringCol()
   value = IntCol()

Test.createTable()

print list(Test.select().limit(1))

   Output:

 1/Query   :  CREATE TABLE test (
    id INTEGER PRIMARY KEY,
    name TEXT,
    value INT
)
 1/QueryR  :  CREATE TABLE test (
    id INTEGER PRIMARY KEY,
    name TEXT,
    value INT
)
 2/Select  :  SELECT test.id, test.name, test.value FROM test WHERE 1 = 1 LIMIT 1
 2/QueryR  :  SELECT test.id, test.name, test.value FROM test WHERE 1 = 1 LIMIT 1
[]

   Seems fine.

Oleg.
--

-- 
     Oleg Broytmann            http://phd.pp.ru/            phd <at> phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Leandro Lucarella | 6 Mar 03:37
Picon

Decoding error using MySQL.

Hi. I'm using MySQL and I'm getting this error:

<type 'exceptions.UnicodeDecodeError'>: 'ascii' codec can't decode byte
0xe1 in position 231: ordinal not in range(128)

This error comes when instancing a SQLObject wich has a PickeCol in wich a
tuple with a unicode string with non-ASCII chars is used.

Let's say:

class X(SQLObject):
	p = PickeCol()

x = X(p=(u'xxx', u'Permite entregar trabajos prácticos'))

I've tried with and without charset=UTF8 in the connection string without
success (tables are created with InnoDB and charset UTF8).

Any ideas?

--

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
The world's best known word is "okay"
The second most well-known word is "Coca-Cola"

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Oleg Broytmann | 6 Mar 09:36
X-Face
Picon
Favicon

Re: Decoding error using MySQL.

On Thu, Mar 06, 2008 at 12:37:00AM -0200, Leandro Lucarella wrote:
> Hi. I'm using MySQL and I'm getting this error:
> 
> <type 'exceptions.UnicodeDecodeError'>: 'ascii' codec can't decode byte
> 0xe1 in position 231: ordinal not in range(128)
> 
> This error comes when instancing a SQLObject wich has a PickeCol in wich a
> tuple with a unicode string with non-ASCII chars is used.
> 
> Let's say:
> 
> class X(SQLObject):
> 	p = PickeCol()
> 
> x = X(p=(u'xxx', u'Permite entregar trabajos pr??cticos'))
> 
> I've tried with and without charset=UTF8 in the connection string without
> success (tables are created with InnoDB and charset UTF8).

   What is the version of SQLObjct? Can we see the entire traceback?

Oleg.
--

-- 
     Oleg Broytmann            http://phd.pp.ru/            phd <at> phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Leandro Lucarella | 10 Mar 03:49
Picon

Re: Decoding error using MySQL.

Oleg Broytmann, el  6 de marzo a las 11:36 me escribiste:
> On Thu, Mar 06, 2008 at 12:37:00AM -0200, Leandro Lucarella wrote:
> > Hi. I'm using MySQL and I'm getting this error:
> > 
> > <type 'exceptions.UnicodeDecodeError'>: 'ascii' codec can't decode byte
> > 0xe1 in position 231: ordinal not in range(128)
> > 
> > This error comes when instancing a SQLObject wich has a PickeCol in wich a
> > tuple with a unicode string with non-ASCII chars is used.
> > 
> > Let's say:
> > 
> > class X(SQLObject):
> > 	p = PickeCol()
> > 
> > x = X(p=(u'xxx', u'Permite entregar trabajos pr??cticos'))
> > 
> > I've tried with and without charset=UTF8 in the connection string without
> > success (tables are created with InnoDB and charset UTF8).
> 
>    What is the version of SQLObjct? Can we see the entire traceback?

Well I was trying in both 0.9.0 and 0.9.4. 0.9.4 seems to work OK, I just
was not creating the tables with charset UTF-8.

So, false alarm =)

--

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
De todos los amigos que he tenido, eres el primero.
	-- Bender

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Gmane