Markus Gritsch | 4 Sep 20:35
Picon
Gravatar

MySQL backend removes backslashes

Hi,

when running the self contained test script below using the SQLite
backend, the output correctly reads

C:\some\path

When using the MySQL backend is reads

C:somepath

Is this a bug?  What is the behavior of other backends.  Shouldn't
SQLObject escape the backslashes for the MySQL backend?

Kind regards,
Markus

from sqlobject import *

# SQLite works fine
#sqlhub.processConnection = connectionForURI('sqlite:/:memory:')

# MySQL removes backslashes
sqlhub.processConnection = connectionForURI('mysql://markus <at> localhost/test')

class Test(SQLObject):
    name = StringCol()

Test.dropTable(ifExists = True)
Test.createTable(ifNotExists = True)
(Continue reading)

Oleg Broytmann | 5 Sep 12:25
X-Face
Picon
Favicon

Re: Bind / Prepare Success (20% to 40% faster), Sample Code

Hello.

On Thu, Aug 30, 2007 at 10:52:38PM -0500, Kevin J. Rice wrote:
>     if not selectResults and self.sqlmeta._perConnection and prepName:
>         statement = "execute %s (%s)" % (prepName, self.id)
>         selectResults = self._connection.queryOne(statement)
> 
> class Org(SQLObject):
>     class sqlmeta:
>         idName = 'OrgID'
>         table  = 'Org'
>         getByIDPrepName = table + '_getByID'
> 
> def getTransaction(tableList = []):
>     dsn = "host=127.0.0.1 dbname=dbrel203 user=krice password=chicken4lunch"
> 
>     con = PostgresConnection(dsn, debug=0)
>     for t in tableList:
>         prepName = None
>         try:
>             prepName = t.sqlmeta.getByIDPrepName
>         except AttributeError:
>             print "No getByIDPrepName defined."
>         assert prepName, "Must define a sqlmeta getByIDPrepName for each
> table object passed into getTransaction."    
>         dbNames = [col.dbName for col in t.sqlmeta.columnList]
>         prep = "prepare %s (int) as select %s from %s where (%s.%s) = $1;" %
> \
>             (t.sqlmeta.table + '_getByID', 
>              ', '.join([x for x in dbNames]), 
(Continue reading)

Oleg Broytmann | 5 Sep 12:33
X-Face
Picon
Favicon

Re: MySQL backend removes backslashes

On Tue, Sep 04, 2007 at 08:35:09PM +0200, Markus Gritsch wrote:
> Test(name=r'C:\some\path')
> print Test.get(1).name # C:somepath when using MySQL

   SQLite:

 4/QueryIns:  INSERT INTO test (name) VALUES ('C:\some\path')
C:\some\path

   Postgres:

 1/QueryIns:  INSERT INTO test (id, name) VALUES (1, 'C:\\some\\path')
C:\some\path

   Please add "?debug=1" to your DB URI and show the output. What version
of SQLObject are you using?

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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
luis cota | 5 Sep 13:18
Picon

IronPython & SQLObject

Has anyone been able to build SQLObject for IronPython successfully?  I attempted to run the standard python version but IronPython has no ZipImport module...
 
Any help is much appreciated...
 
Thanks!
 
- Luis
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Oleg Broytmann | 5 Sep 13:31
X-Face
Picon
Favicon

Re: IronPython & SQLObject

On Wed, Sep 05, 2007 at 07:18:15AM -0400, luis cota wrote:
> Has anyone been able to build SQLObject for IronPython successfully?  I
> attempted to run the standard python version but IronPython has no ZipImport
> module...

   Why do you need ZipImport for SQLObject? To use an egg?

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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
luis cota | 5 Sep 13:46
Picon

Re: IronPython & SQLObject

I suppose I don't *need* SQLObject, that was just how I had it installed.  I am attempting to run the build.py script using the ipy.exe executable but the script failes with:
 
error: package directory 'sqlobject' does not exist
 
- Luis

 
On 9/5/07, Oleg Broytmann <phd <at> phd.pp.ru> wrote:
On Wed, Sep 05, 2007 at 07:18:15AM -0400, luis cota wrote:
> Has anyone been able to build SQLObject for IronPython successfully?  I
> attempted to run the standard python version but IronPython has no ZipImport
> module...

  Why do you need ZipImport for SQLObject? To use an egg?

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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>   http://get.splunk.com/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Oleg Broytmann | 5 Sep 13:51
X-Face
Picon
Favicon

Re: IronPython & SQLObject

On Wed, Sep 05, 2007 at 07:46:59AM -0400, luis cota wrote:
> error: package directory 'sqlobject' does not exist

   Instead of using the egg try unzipping the directory sqlobject out of
the egg. Or extract it from the source tarball.

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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
luis cota | 5 Sep 13:59
Picon

Re: IronPython & SQLObject

I extracted the sqlobject folder from the egg directory in my site-packages.  When attempting an import, this is the error returned in IronPython.  Perhaps you can help me with building the library? 
 
>>> import sqlobject
Traceback (most recent call last):
  File , line 0, in <stdin>##93
  File , line 0, in __import__##4
  File C:\IronPython\lib\site-packages\sqlobject\__init__.py, line 1, in Initial
ize
  File , line 0, in __import__##4
  File C:\IronPython\lib\site-packages\sqlobject\main.py, line 40, in Initialize

  File , line 0, in __import__##4
  File C:\IronPython\lib\site-packages\sqlobject\dbconnection.py, line 19, in In
itialize
  File , line 0, in __import__##4
  File C:\IronPython\lib\site-packages\sqlobject\col.py, line 30, in Initialize
  File , line 0, in __import__##4
  File C:\IronPython\lib\site-packages\formencode-0.7.1-py2.5.egg\formencode\__i
nit__.py, line 1, in Initialize
  File , line 0, in __import__##4
  File C:\IronPython\lib\site-packages\formencode- 0.7.1-py2.5.egg\formencode\api
.py, line 9, in Initialize
  File , line 0, in __import__##4
  File C:\IronPython\lib\site-packages\setuptools-0.7a1dev_r53614-py2.5.egg\pkg_
resources.py, line 16, in Initialize
  File , line 0, in __import__##4
ImportError: No module named zipimport



On 9/5/07, Oleg Broytmann <phd <at> phd.pp.ru> wrote:
On Wed, Sep 05, 2007 at 07:46:59AM -0400, luis cota wrote:
> error: package directory 'sqlobject' does not exist

  Instead of using the egg try unzipping the directory sqlobject out of
the egg. Or extract it from the source tarball.

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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>   http://get.splunk.com/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
luis cota | 5 Sep 14:03
Picon

Re: IronPython & SQLObject

After clearing out my site-packages directory and leaving only sqlobjects, this is what is returned:
 
>>> import sqlobject
Traceback (most recent call last):
  File , line 0, in <stdin>##83
  File , line 0, in __import__##4
  File C:\IronPython\lib\site-packages\sqlobject\__init__.py, line 1, in Initial
ize
  File , line 0, in __import__##4
  File C:\IronPython\lib\site-packages\sqlobject\main.py, line 40, in Initialize

  File , line 0, in __import__##4
  File C:\IronPython\lib\site-packages\sqlobject\dbconnection.py, line 19, in In
itialize
  File , line 0, in __import__##4
  File C:\IronPython\lib\site-packages\sqlobject\col.py, line 30, in Initialize
  File , line 0, in __import__##4
ImportError: No module named formencode



On 9/5/07, luis cota <lo.maximo73 <at> gmail.com> wrote:
I extracted the sqlobject folder from the egg directory in my site-packages.  When attempting an import, this is the error returned in IronPython.  Perhaps you can help me with building the library? 
 
>>> import sqlobject
Traceback (most recent call last):
  File , line 0, in <stdin>##93
  File , line 0, in __import__##4
  File C:\IronPython\lib\site-packages\sqlobject\__init__.py, line 1, in Initial
ize
  File , line 0, in __import__##4
  File C:\IronPython\lib\site-packages\sqlobject\main.py, line 40, in Initialize

  File , line 0, in __import__##4
  File C:\IronPython\lib\site-packages\sqlobject\dbconnection.py, line 19, in In
itialize
  File , line 0, in __import__##4
  File C:\IronPython\lib\site-packages\sqlobject\col.py, line 30, in Initialize
  File , line 0, in __import__##4
  File C:\IronPython\lib\site-packages\formencode-0.7.1-py2.5.egg\formencode\__i
nit__.py, line 1, in Initialize
  File , line 0, in __import__##4
  File C:\IronPython\lib\site-packages\formencode- 0.7.1-py2.5.egg\formencode\api
.py, line 9, in Initialize
  File , line 0, in __import__##4
  File C:\IronPython\lib\site-packages\setuptools-0.7a1dev_r53614-py2.5.egg\pkg_
resources.py, line 16, in Initialize
  File , line 0, in __import__##4
ImportError: No module named zipimport



On 9/5/07, Oleg Broytmann <phd <at> phd.pp.ru > wrote:
On Wed, Sep 05, 2007 at 07:46:59AM -0400, luis cota wrote:
> error: package directory 'sqlobject' does not exist

  Instead of using the egg try unzipping the directory sqlobject out of
the egg. Or extract it from the source tarball.

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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>   http://get.splunk.com/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Oleg Broytmann | 5 Sep 14:22
X-Face
Picon
Favicon

Re: IronPython & SQLObject

On Wed, Sep 05, 2007 at 08:03:57AM -0400, luis cota wrote:
> ImportError: No module named formencode

   SQLObject requires FormEncode.

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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

Gmane