Oleg Broytmann | 1 Feb 15:52 2008
X-Face
Picon

Re: can i use cacheValues=True with transactions ?

On Thu, Jan 17, 2008 at 03:57:25PM +0900, masayuki.takagi wrote:
> it's ok that "the problem is fixed now" and "the document has not  
> been updated yet" ?

   I just fixed the docs in the Subversion. The change will be on the site
at the next update (probably after I release SQLObject 0.10).

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/
Barry Ferg | 4 Feb 06:04 2008

orderBy = SQL function?

Is there some way of reliably using the orderBy parameter with
something other than a simple column, like a SQL function?  Right now
I do something like the following (where sbtable is
sqlobject.sqlbuilder.table):

class Contact (SQLObject):
    class sqlmeta:
        defaultOrder = \
               func.CONCAT(func.IFNULL(sbTable.contacts.last_name, ""),
                           func.IFNULL(sbTable.contacts.first_name, ""),
                           func.IFNULL(sbTable.contacts.organization, ""))

While this works for queries on this table alone, as soon as I try
refer to the table from another SQLObject class via a MultipleJoin
with no orderBy parameter I get an AttributeError (SQLCall instance
has no attribute '__getitem__'  in sqlobject/joins.py:100).  Setting
orderBy=None in the MultipleJoin declaration clears it up, but of
course result ordering is hosed at that point.

Are SQL functions not allowed as orderBy parameters in all cases?
Does anyone have any other ideas?

Thanks,
Barry

-------------------------------------------------------------------------
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/
(Continue reading)

Oleg Broytmann | 4 Feb 08:33 2008
X-Face
Picon

Re: orderBy = SQL function?

On Sun, Feb 03, 2008 at 09:04:20PM -0800, Barry Ferg wrote:
> Is there some way of reliably using the orderBy parameter with
> something other than a simple column, like a SQL function?

   Use SQLMultipleJoin instead of MultipleJoin. The difference is that
MultipleJoin returns a list (that is sorted by SQLObject in Python, hence
orderBy can be only a name of a column) where SQLMultipleJoin returns
whatever .select() returns (an instance of SelectResult class) which passes
orderBy to SQL.

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/
vishnu | 4 Feb 10:17 2008
Picon

Database is locked

Hi,
    Im currently using 0.9.2 version SQLObject in my CentOS5.1 system.

Im using SQLObject in a multi-threaded application. I have my own mutex lock to prevent more than one write operation. No restrictions in application for Read operation.

My problem is that i get occational "Database is locked error".

Im not sure as to the cause of this issue. is there a way to give a timeout to wait for lock release.
can anyone help,

I dont find any help in SQLObject site about any syntax on timeout

please help
--
Vishnu,
Developer,
B I N A R Y K A R M A,
Mobile : +91-9994475599
Tel : 044-64621656
email: vishnu <at> binarykarma.com


"A husband and wife are like clothes for each other,
Those among you are the best who are good to their wives".
- Muhammad, the final Prophet (peace be upon him)

-------------------------------------------------------------------------
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
Jorge Godoy | 4 Feb 11:00 2008
Picon

Re: Database is locked

vishnu wrote:

> Hi,
>     Im currently using 0.9.2 version SQLObject in my CentOS5.1 system.
> 
> Im using SQLObject in a multi-threaded application. I have my own mutex
> lock to prevent more than one write operation. No restrictions in
> application for Read operation.

Why can't you let the database server take care of locking things as needed? 
I have applications used by multiple users in multiple processes (web) and
the database does all what is needed.  It really feels like if there were
several desktop applications and all of them worked simultaneously.

> My problem is that i get occational "Database is locked error".
> 
> Im not sure as to the cause of this issue. is there a way to give a
> timeout to wait for lock release.

It should probably be a problem in your locking mechanism...

> I dont find any help in SQLObject site about any syntax on timeout

Google give some hints of using other modules to have this implemented.  But
I still believe that it would be better to let the database handle that.

-------------------------------------------------------------------------
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 | 4 Feb 16:57 2008
X-Face
Picon

Re: Database is locked

On Mon, Feb 04, 2008 at 02:47:48PM +0530, vishnu wrote:
> My problem is that i get occational "Database is locked error".

   By this error I can guess you are using SQLite as the backend. I don't
know a way to fix or overcome the problem with SQLite.
   I have been developing a few commercial programs that use SQLObject. For
small customer where there are only 1 or 2 clients applications I use
SQLite as the backend. But for larger installations where I need to install
more client applications connected to one backend I use a real database
server. I use PostgreSQL but you can use whatever suites your needs
- PostgreSQL or MySQL, e.g.

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/
Nick Murdoch | 4 Feb 17:37 2008

Re: Database is locked

>    By this error I can guess you are using SQLite as the backend. I don't
> know a way to fix or overcome the problem with SQLite.

You can "fix" the broken database by using sqlite's `.output FILENAME`
followed by `.dump` to output all the data, then read it back into a
blank sqlite database with `sqlite newdatabase.sqlite < FILENAME`.

These sort of problems are why I started just using a test psql database
for developing with, rather than sqlite :)

-------------------------------------------------------------------------
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 | 4 Feb 19:07 2008
Picon

Re: Database is locked

Oleg Broytmann, el  4 de febrero a las 18:57 me escribiste:
> On Mon, Feb 04, 2008 at 02:47:48PM +0530, vishnu wrote:
> > My problem is that i get occational "Database is locked error".
> 
>    By this error I can guess you are using SQLite as the backend. I don't
> know a way to fix or overcome the problem with SQLite.

There is a parameter to SQLite to wait for the lock for a while. Just pass
timeout=something when creating the SQLite connection, for example:
sqlite:///....?timeout=5000
If you want it to wait 5 seconds before raising the database locked
exception.

It seems that this parameter is still undocumented :)

--

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
CHINO ATRAPA COTORRAS
	-- Crónica TV

-------------------------------------------------------------------------
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 | 4 Feb 21:41 2008
X-Face
Picon

Re: Database is locked

On Mon, Feb 04, 2008 at 04:07:38PM -0200, Leandro Lucarella wrote:
> Oleg Broytmann, el  4 de febrero a las 18:57 me escribiste:
> > On Mon, Feb 04, 2008 at 02:47:48PM +0530, vishnu wrote:
> > > My problem is that i get occational "Database is locked error".
> > 
> >    By this error I can guess you are using SQLite as the backend. I don't
> > know a way to fix or overcome the problem with SQLite.
> 
> There is a parameter to SQLite to wait for the lock for a while. Just pass
> timeout=something when creating the SQLite connection, for example:
> sqlite:///....?timeout=5000
> If you want it to wait 5 seconds before raising the database locked
> exception.

   It never helped me. Probably I had been doing something wrong.

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/
Barry Ferg | 5 Feb 04:00 2008

Re: orderBy = SQL function?

On Feb 3, 2008 11:33 PM, Oleg Broytmann <phd <at> phd.pp.ru> wrote:
> On Sun, Feb 03, 2008 at 09:04:20PM -0800, Barry Ferg wrote:
> > Is there some way of reliably using the orderBy parameter with
> > something other than a simple column, like a SQL function?
>
>    Use SQLMultipleJoin instead of MultipleJoin. The difference is that
> MultipleJoin returns a list (that is sorted by SQLObject in Python, hence
> orderBy can be only a name of a column) where SQLMultipleJoin returns
> whatever .select() returns (an instance of SelectResult class) which passes
> orderBy to SQL.
>
> Oleg.

Thanks Oleg, that works!  I don't think the documentation had anything
to say about the way that relates to orderBy - I suppose I should
spend more quality time with the source.

-------------------------------------------------------------------------
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