Picon

BLOBCol and MySQLdb 1.2.1+

Hi all,

I'm having problems with BLOBCol on MySQLdb 1.2.1+.  I use UTF-8
as the charset for connection, and consequently I cannot save binary
data to the BLOB column. I tracked this down to sqlobject/mysql/mysqlconnection.py,
line 78:

                    # For MysqlDB 1.2.1 and later, we go
                    # encoding->unicode->charset (in the mysql db)
                    myquery = unicode(query, self.encoding)
                    return cursor.execute(myquery)

However, the query (the generated SQL query) contain's binary data, so unicode
function fails.

It seems that this conversion to unicode should be done while still building
the query, i.e. convert only string column values, not blobs or column names.

While I could possibly dig into this and fix it, I wonder maybe anyone else has
solution for this?

Cheers,
Adomas

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Picon

Transactions leaking memory?

I am having problems with an application of mine leaking memory. The
application reads in some files, parses the data, and does a few
inserts and/or updates depending on the data in the files. My problem
is that the applications memory usage (as reported by top) is growing
by roughly 20-40 bytes every time a file is read and processed.

By writing a couple of test cases, I have identified the problem to
have something to do with the use of transactions. This is illustrated
by a simple test case. If the following insert is put into an infinite
loop the memory usage stays constant (Metadata is a class that
inherits from SQLObject):

while True:
	m = Metadata(
		orderflow = None,
		transaction = None,
		time = DateTime.now(),
		fieldName = "Comment",
		fieldContents = "duh"
		)

However, if the loop is modified to look like this, the memory usage
will keep rising:

while True:
	trans = connection.transaction()
	m = Metadata(
		connection = trans,
		orderflow = None,
		transaction = None,
		time = DateTime.now(),
		fieldName = "Comment",
		fieldContents = "duh"
		)
	trans.commit()

Reusing the same transaction object (with trans.begin()) yields the
same results.
This is using a trunk version of sqlobject (rev. 2171) and psycopg
2.0.5.1 connecting to postgresql 8.1.5. Python is 2.4.3 running on
x86-64.

How do I keep the transactions from leaking memory?

Thanks in advance,
-Toke

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Oleg Broytmann | 3 Jan 12:54
X-Face
Picon
Favicon

Re: Transactions leaking memory?

On Tue, Jan 02, 2007 at 10:43:41PM +0100, Toke H??iland-J??rgensen wrote:
> How do I keep the transactions from leaking memory?

   trans.cache.clear() (I suppose the "problem" which is not really a bug
is in the cache. If not you have to investigate further.)

Oleg.
--

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

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Picon

Re: Transactions leaking memory?

trans.cache.clear() made the problem disappear from the test case from
my last mail (why are objects cached when sqlmeta.cacheValues is set
to False?). However, the application is still leaking memory, although
not as much as before. As far as I can see by stepping through with
the debugger it happens when using SelectResults.

Do SelectResults objects need to be expired, and if so, how?

I am pretty sure that i .expire() all SQLObject objects and run
.cache.clear() on both the connection and transaction objects when i'm
done with them. Is there anything else I need to do to clear caches?

Thanks again,
-Toke

On 1/3/07, Oleg Broytmann <phd <at> phd.pp.ru> wrote:
> On Tue, Jan 02, 2007 at 10:43:41PM +0100, Toke H??iland-J??rgensen wrote:
> > How do I keep the transactions from leaking memory?
>
>    trans.cache.clear() (I suppose the "problem" which is not really a bug
> is in the cache. If not you have to investigate further.)
>
> Oleg.
> --
>      Oleg Broytmann            http://phd.pp.ru/            phd <at> phd.pp.ru
>            Programmers don't die, they just GOSUB without RETURN.
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> sqlobject-discuss mailing list
> sqlobject-discuss <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
David Turner | 4 Jan 19:52
Favicon
Gravatar

Re: Patch: versioning

On Sat, 2006-12-30 at 08:13 +0200, Dan Pascu wrote:
> On Thursday 28 December 2006 21:40, David Turner wrote:
> > I should probably also have a method which returns a dict of only items
> > that have changed between this version and a specified version (by
> > default, the current version).
> 
> Such a method would be nice.

OK, it's in svn.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Dan Pascu | 4 Jan 21:29
Favicon
Gravatar

Re: Patch: versioning

On Thursday 04 January 2007 20:52, David Turner wrote:
> On Sat, 2006-12-30 at 08:13 +0200, Dan Pascu wrote:
> > On Thursday 28 December 2006 21:40, David Turner wrote:
> > > I should probably also have a method which returns a dict of only
> > > items that have changed between this version and a specified
> > > version (by default, the current version).
> >
> > Such a method would be nice.
>
> OK, it's in svn.

Thank you

--

-- 
Dan

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Christoph Berendes | 7 Jan 05:07

macosx: 12 tests fail/186 pass,incl. SQLMultipleJoin

I'm trying to install SQLObject on my Ibook running MACOS 10.4.8,  python 2.3.5 and SQLite version 3.1.3

I've installed and test pysqlite 2.3.2 successfully, then checked out SQLObject from the trunk and ran setup.py build and setup.py install with no error messages.

Running py.test with no arguments then generates 186 tests passed but also 12 tests failed:
sqlobject/tests/test_SQLMultipleJoin.py[1] F
sqlobject/tests/test_auto.py[5] .FFF.
sqlobject/tests/test_auto_old.py[4] .FF.
sqlobject/tests/test_foreignKey.py[2] .F
sqlobject/tests/test_select.py[14] ............F.
sqlobject/tests/test_sqlobject_admin.py - FAILED TO LOAD MODULE
sqlobject/tests/test_transactions.py[4] ..FF
sqlobject/versioning/test/test_version.py[6] ....F.

I assume that all tests should pass, so I'd be grateful for pointers as to how to begin troubleshooting.

Thanks.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Diez B. Roggisch | 8 Jan 12:02
Favicon

DecimalCol

Hi, 

I simply don't get the decimal column support to work - it will always return 
floats.

I'm using turbogears, sqlobject 7.2, and I tried psycopg as well as psycopg2.

Any suggestions?

-- 
>> Diez B. Roggisch
>> Developer

T  +49 (30) 443 50 99 - 27
F  +49 (30) 443 50 99 - 99
M  +49 (179) 11 75 303
E  diez.roggisch <at> artnology.com

>> artnology GmbH

A  Milastraße 4 / D-10437 Berlin
T  +49 (30) 443 50 99 - 0
F  +49 (30) 443 50 99 - 99
E  info <at> artnology.com
I  http://www.artnology.com

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Diez B. Roggisch | 8 Jan 12:14
Favicon

Re: DecimalCol

On Monday 08 January 2007 12:02, Diez B. Roggisch wrote:
> Hi,
>
> I simply don't get the decimal column support to work - it will always
> return floats.
>
> I'm using turbogears, sqlobject 7.2, and I tried psycopg as well as
> psycopg2.
>
> Any suggestions?

False alarm. The problem was that I tested in TG using sqlite - but with 
a "real" database, things worked out as expected.

Diez

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
Diez B. Roggisch | 9 Jan 14:17
Favicon

event callbacks somwhere?

Hi,

the docs don't mention anything - so I ask: is there a way to have events 
thrown  when there are actual updates/inserts on certain objects?

I've got some rather complex to compute data I'd like to cache until the base 
of that data- some persistent objects - change.

Regards,

-- 
>> Diez B. Roggisch
>> Developer

T  +49 (30) 443 50 99 - 27
F  +49 (30) 443 50 99 - 99
M  +49 (179) 11 75 303
E  diez.roggisch <at> artnology.com

>> artnology GmbH

A  Milastraße 4 / D-10437 Berlin
T  +49 (30) 443 50 99 - 0
F  +49 (30) 443 50 99 - 99
E  info <at> artnology.com
I  http://www.artnology.com

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Gmane