tyson | 2 Feb 20:17

schema name ?

Hi,
   I have a question regarding the schema naming process.  When I create 
a class "Person" with SQLObject it automatically adds a person table to 
the "public" schema in my postgres database.   If I want it to add this 
table into a different schema, lets say "hr", then I am unsure of the 
correct way to implement this.  I know if I set the tag 
"_tableName=hr.person" in the class itself, it works and the table is 
added where I want it.   On the other hand, after doing this I created 
an Address class with a foreign key to Person.  When I add a join to 
these two tables everything works correctly, but then when I query the 
person table to look for resulting address's I run into an error.

For example when I run this line of code I get an inner-join error:

"Person.get(1).addresses"

the sql generated is incorrect.  It doesn't add the tablename person to 
the corresponding field.  Here is the result:

SELECT address_id FROM hr.address WHERE hr.person_id = (1)

It should say "WHERE hr.Person.person_id = (1)".  Does anyone know how to fix this problem?

--

-- 
Tyson Wenger
Computer Programmer
V&L Tool,Inc.

2021 MacArthur Rd.
Waukesha, WI 53188
(Continue reading)

Oleg Broytmann | 2 Feb 20:30
X-Face
Picon
Favicon

Re: schema name ?

On Fri, Feb 02, 2007 at 01:17:56PM -0600, tyson wrote:
> Does anyone know how to fix this problem?

   We have some bug reports about it, and there is an incomplete patch...

http://sqlobject.gcu.info/trac/ticket/159
http://sqlobject.gcu.info/trac/ticket/289

Oleg.
--

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

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Dan Pascu | 3 Feb 07:04
Favicon
Gravatar

Patch to improve ids for mysql databases


Currently the mysql backend for sqlobject uses an int for the table id 
when generating the schema. The attached patch modifies it to use an 
unsigned int. This will result in doubling the range of available ids and 
also makes more sense considering that the table id is never negative.

--

-- 
Dan
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Oleg Broytmann | 3 Feb 11:45
X-Face
Picon
Favicon

Re: Patch to improve ids for mysql databases

On Sat, Feb 03, 2007 at 08:04:23AM +0200, Dan Pascu wrote:
> +        return '%s INT UNSIGNED PRIMARY KEY AUTO_INCREMENT' % soClass.sqlmeta.idName

   Ok, thank you.

Oleg.
--

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

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Jim Steil | 5 Feb 22:56

How would I do this?

I have a legacy table that I’m trying to update.  It has an integer primary key that works fine for most of what I’m doing.  But, in some situations I need to update a record based on values in 2 other fields.  Below is a snippet of the def:

 

class OrderItem(SQLObject):

    class sqlmeta:

        style = Style(longID=True)

        idName = 'orderItemId'

       

    orderItemId = IntCol()

    orderNumber = IntCol()

    lineNumber = IntCol()

 

What I need to do is find out if the orderNumber/lineNumber combination exists and if so, do an update of the attributes instead of adding a new record.

 

I suppose I could do a select and return an object and then do a get based on the orderItemId, but that seems cumbersome.  Is there something I can do so that I can perform a get against 2 columns, orderNumber and lineNumber in this case, something similar to:

 

X = OderItem.get(orderNumber=1234, lineNumber=1)

 

            -Jim

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
sophana | 6 Feb 09:43

Re: How would I do this?

Jim Steil a écrit :

I have a legacy table that I’m trying to update.  It has an integer primary key that works fine for most of what I’m doing.  But, in some situations I need to update a record based on values in 2 other fields.  Below is a snippet of the def:

 

class OrderItem(SQLObject):

    class sqlmeta:

        style = Style(longID=True)

        idName = 'orderItemId'

       

    orderItemId = IntCol()

    orderNumber = IntCol()

    lineNumber = IntCol()

 

What I need to do is find out if the orderNumber/lineNumber combination exists and if so, do an update of the attributes instead of adding a new record.

 

I suppose I could do a select and return an object and then do a get based on the orderItemId, but that seems cumbersome.  Is there something I can do so that I can perform a get against 2 columns, orderNumber and lineNumber in this case, something similar to:

 

X = OderItem.get(orderNumber=1234, lineNumber=1)

 

            -Jim

Why not a select?
X=OrderItem.selectBy(orderNumber=1234, lineNumber=1)
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Oleg Broytmann | 6 Feb 16:23
X-Face
Picon
Favicon

Re: [PATCH] Allow empty argument list to AND/OR

Hello!

On Tue, Jan 23, 2007 at 11:51:27AM -0200, Johan Dahlin wrote:
>  def AND(*ops):
> +    if not ops:
> +        return

   Committed in th trunk, doc bracnh and 0.8 branch in the revisions
2255-2257. Thank you!

Oleg.
--

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

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Jim Steil | 6 Feb 16:31

decoding Unicode is not supported

Hi:

 

I’m getting the following exception using SQLObject.  I’ve done some searches to find out what to do about this, but can’t seem to find a definitive answer about what I need to do to make this go away.  Is there an easy way to fix this without specifically encoding each and every string attribute before setting it on my object?

 

      -Jim

 

Traceback (most recent call last):

  File "C:\PyWork\Scripts\Synchronization\syncOrders2.py", line 164, in ?

    arrivalNumber=arrivalNumber, hasBeenFaxed=hasBeenFaxed, fobCode=fobCode)

  File "c:\python24\lib\site-packages\SQLObject-0.7.2-py2.4.egg\sqlobject\declarative.py", line 93, in _wrapper

    return fn(self, *args, **kwargs)

  File "c:\python24\lib\site-packages\SQLObject-0.7.2-py2.4.egg\sqlobject\main.py", line 1203, in __init__

    self._create(id, **kw)

  File "c:\python24\lib\site-packages\SQLObject-0.7.2-py2.4.egg\sqlobject\main.py", line 1230, in _create

    self._SO_finishCreate(id)

  File "c:\python24\lib\site-packages\SQLObject-0.7.2-py2.4.egg\sqlobject\main.py", line 1254, in _SO_finishCreate

    id, names, values)

  File "c:\python24\lib\site-packages\SQLObject-0.7.2-py2.4.egg\sqlobject\dbconnection.py", line 361, in queryInsertID

    return self._runWithConnection(self._queryInsertID, soInstance, id, names, values)

  File "c:\python24\lib\site-packages\SQLObject-0.7.2-py2.4.egg\sqlobject\dbconnection.py", line 221, in _runWithConnection

    val = meth(conn, *args)

  File "c:\python24\lib\site-packages\SQLObject-0.7.2-py2.4.egg\sqlobject\mysql\mysqlconnection.py", line 98, in _queryInsertID

    self._executeRetry(conn, c, q)

  File "c:\python24\lib\site-packages\SQLObject-0.7.2-py2.4.egg\sqlobject\mysql\mysqlconnection.py", line 77, in _executeRetry

    myquery = unicode(query, self.encoding)

TypeError: decoding Unicode is not supported

 

 

 

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Oleg Broytmann | 6 Feb 16:39
X-Face
Picon
Favicon

Re: Patch to handle sets with the IN operator

On Wed, Jan 24, 2007 at 11:32:57PM +0200, Dan Pascu wrote:
> The attached patch allows one to use set/frozenset sets (available since 
> python 2.4) or Set/ImmutableSet sets (available since python 2.3) as 
> sequences passed to the IN operator (currently only lists and tuples can 
> be used). In fact it'll accept a set of values everywhere a list/tuple of 
> values is accepted.

   Committed in the trunk, docs and 0.8 branch in the revisions 2258-2260.
Thank you!

Oleg.
--

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

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Oleg Broytmann | 6 Feb 17:12
X-Face
Picon
Favicon

Re: decoding Unicode is not supported

On Tue, Feb 06, 2007 at 09:31:52AM -0600, Jim Steil wrote:
>     myquery = unicode(query, self.encoding)
> 
> TypeError: decoding Unicode is not supported

   "query" must be string here. You have passed a unicode somewhere to
SQLObject where it is not allowed.

Oleg.
--

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

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Gmane