Firebird linux client => windows SQL server problem

Hi,
I have encountered following problem:
Firebird db is running on the windows server.

the connection string is following:

db_filename = 'd|\\sgdata\\test\\sysdat01.gdb'
connection_string = 'firebird://winsrv.xxx.xx:3050/' + db_filename
connection = connectionForURI(connection_string)

From the windows machine as a client everything works fine.

From the linux machine as a client:

Traceback (most recent call last):
  File "romana_Import_01.py", line 65, in <module>
    jenKdyzText()
  File "romana_Import_01.py", line 49, in jenKdyzText
    for radek in Cenktgm01.select():
  File "/usr/local/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/sresults.py", line 179, in __iter__
    return iter(list(self.lazyIter()))
  File "/usr/local/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/sresults.py", line 187, in lazyIter
    return conn.iterSelect(self)
  File "/usr/local/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/dbconnection.py", line 394, in iterSelect
    return select.IterationClass(self, self.getConnection(),
  File "/usr/local/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/dbconnection.py", line 259, in getConnection
    conn = self.makeConnection()
  File "/usr/local/lib/python2.5/site-packages/SQLObject-0.10.1-py2.5.egg/sqlobject/firebird/firebirdconnection.py", line 84, in makeConnection
    **extra
  File "/usr/local/lib/python2.5/site-packages/kinterbasdb/__init__.py", line 433, in connect
    return Connection(*args, **keywords_args)
  File "/usr/local/lib/python2.5/site-packages/kinterbasdb/__init__.py", line 610, in __init__
    b.dsn, b.dpb, b.dialect, timeout
kinterbasdb.OperationalError: (-902, 'isc_attach_database: \n  I/O error for file "/d|\\sgdata\\test\\sysdat01.gdb"\n  Error while trying to open file\n  N\xe1zev souboru, adres\xe1\xf8e nebo jmenovka svazku je nespr\xe1vn\xe1.')
[root <at> automat romana]#

It looks like a SQLObject parsing is dooing something wrong and windows server can not recognize the name of the database file.

Regards

Petr
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Leandro Sales | 1 Oct 00:15

Query using ends with

Hello. Please consider the following: I have a sqlobject object named
Domain that stores the list of available domains:

class Domain(SQLObject):
    name = StringCol(alternateID=True, length=255, default=None)

In the database I have domains like:

ID    name
--------------------------
1     domain1.com
2     domain2.com

I'd like to query the domain into the database that contains in a
given hostname, lets say "www.domain1.com".

I now that I can do something like:

domain = Domain.select(Domain.q.name.endswith("www.domain1.com"))

but instead, I'd check which domain name is in the hostname. Somethink like:

domain = Domain.select("www.domain1.com".endswith(Domain.q.name.endswith()))

.. but sqlobject doesn't allow me to do this. Any clue?

Thank you,
Leandro.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Leandro Sales | 1 Oct 22:52

Query using sqlobject.sqlbuilder.AND

How can I add more than 2 ands in a query?

Something like:
  MySQLObject.select(AND(X,Y,Z))

Thank you,
Leandro.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Leandro Sales | 1 Oct 21:14

Lazy query

Hi,
  I have an sqloject object (ObjectParent) that contains others
sqlobject objects (OtherObject):

class ObjectParent(SQLObject):
    name = StringCol(alternateID=True, length=255, default=None)
    objects = MultipleJoin("OtherObject", joinColumn="objectId")

class OtherObject(SQLObject):
    name = StringCol(alternateID=True, length=255, default=None)
    object = ForeignKey('ObjectParent', dbName='objectId', cascade=True)

Then if I do

 x = ObjectParent.select(some_query)

... aparrently sqlobject loads also x.objects, selecting all related
objects. Is it possible to tell to sqlobject to query the records only
when I read x.objects for the first time?

Thank you,
Leandro.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Markus W. Barth | 28 Sep 18:17

UnicodeEncodeError

I have run into that before and can't remember how I got around it:

UnicodeEncodeError: 'ascii' codec can't encode character u'\xf3'

This is what I'm trying to do: 
solicitud = model.Solicitud(lugar_nacimiento     = 
kw['lugar_nacimiento'].decode('utf-8'))

I have also tried 
solicitud = model.Solicitud(lugar_nacimiento     = kw['lugar_nacimiento'])

where the problem is the word 'Gijón' passed to a input field and which prints 
out nicely as 'Gij\u00f3n'

Any hints? (this one should be on the FAQ ;-)

I am using SQLObject (this time) with turbogears on Ubuntu with mysql 
5.0.51a-3ubuntu5.1 for debian-linux-gnu on x86_64

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
David Turner | 27 Sep 19:48
Favicon

Inheritance and signals

Depending on how attributes are set on child classes, rowupdatesignal
fires either just on the base class, or on both the base and the child.
This is inconsistent.

from sqlobject import *
from sqlobject.inheritance import InheritableSQLObject

class Base(InheritableSQLObject):
    name = StringCol()

    def _set_name(self, new_name):
        print "base", new_name
        self._SO_set_name(new_name)

class Child(Base):

    def _set_name(self, new_name):
        print "child", new_name
        self._SO_set_name(new_name)

sqlhub.processConnection = connectionForURI('sqlite:/:memory:')

Base.createTable()
Child.createTable()

def rowUpdateb(instance, kwargs):
    print "base signal", instance, kwargs

def rowUpdatec(instance, kwargs):
    print "child signal", instance, kwargs

events.listen(rowUpdateb, Base, events.RowUpdateSignal)
events.listen(rowUpdatec, Child, events.RowUpdateSignal)

c = Child(name="zero")
c.name = "one" #once
c.set(name="two") #twice

-----------
results:

base zero
base one
base signal <Base 1 name='zero'> {'name': 'one'}
child signal <Child 1 name='one'> {'name': 'two'}
base two
base signal <Base 1 name='one'> {'name': 'two'}

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Dan Pascu | 10 Sep 14:01
Favicon

dburi argument handling fixes


I just commited some fixes regarding how the dburi parameters are handled.

The first fix is for incorrect handling of calls like 

connectionForURI(dburi, cache=False)

when dburi already contains some parameters encoded in the URI, like 
mysql://user:pass <at> host/db?debug=1

The second fix is for incorrectly interpretted boolean values passed via 
arguments to connectionForURI or via dburi parameters. Because internally 
connectionForURI encodes all arguments using urllib.encode, they end up 
like strings. Same for dburi parameters which are extracted as strings.

As a result any such value will end up in DBConnection as a string instead 
of a boolean, being misinterpretted whenever a false value is intended.

For example connectionForURI(dburi, cache=False) will result in 
DBConnection receiving a cache='False' argument, which evaluates to True 
as a boolean value since the string 'False' is not empty.
Similarly, dburi='mysql://user:pass <at> host/db?debug=0' will end up as 
debug='0' in DBConnection, being interpretted again as True since it's a 
non-empty string.

Before this fix, the only way to pass a False value to such an argument 
was to use an empty string, like '...?debug=', which is not intuitive, 
not to mention that interpreting '?debug=0' as debug=True is confusing.

I committed these changes to trunk, 0.10 and 0.9

They are backward compatible, in the sense that if you ever used an empty 
string to indicate a False boolean value, it is still interpretted that 
way, but from now on you can use '?keyword=0' to indicate a keyword with 
a false value. As a bonus, the new implementation also accepts some 
string keywords and interprets them as boolean value: yes/no, true/false, 
on/off in addition to the standard 1/0. So one can write something 
like '?debug=yes&cache=off', which is more human readable. Any other 
non-empty string is still interpreted as true as before.

--

-- 
Dan

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Florian Haas | 4 Sep 12:35

Storing password hashes using built-in functions like PASSWORD() (where available)

[First post to list, hello everyone!]

Hi,

I'm failing to find a solution to an issue that seems fairly commonplace
to me, so I'm assuming it's been answered before and I failed to dig up
the answer (I tried). So feel free to alert me to any resources where
this type of question has previously been answered.

I'm currently trying to figure out a way to store a password hash in a
table, allowing the password to be passed in in plain. I'd prefer to use
a built-in password hashing functions on connections that support them,
like so:

from sqlobject import *
from Crypto.Hash import SHA256
class Credential(SQLObject):
    username = StringCol(unique=True, alternateID=True)
    password = StringCol()
    def _set_password(self, newpass):
        try:
            # FIXME: update field with hash generated
            # from PASSWORD(newpass)
        except dberrors.OperationalError:
            # assume internal password function is
            # not available, do my own hashing
            hash = SHA256.new(newpass).hexdigest()
            self._SO_set_password(hash)

So the "do my own hashing" part is easily achieved. It's the use of the
internal password function that's baffling me. I'd like to use
PASSWORD() on MySQL, and I believe this should work for MS SQL Server
too as it also appears to have a built-in password hashing function.

Is there a way to achieve this, combining _SO_set_* and
sqlbuilder.func.PASSWORD perhaps? If so, how would I do that?

Grateful for any insights. Thanks much in advance.

Cheers,
Florian

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Matthew Wilson | 3 Sep 15:41

How do I use a postgreSQL function like date_part?

I want to do a select like this with SQLObject:

    select * from people 
    where date_part('day', createddate) = date '2008-09-01';

That query should choose people created any time on September 1st.

In SQLObject, this is what I'm doing:

    People.select("date_part('day', createddate) = date '2008-09-01'")

Is there some way to avoid using a string of raw SQL?

Matt

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
sophana | 19 Aug 23:07

problem clearing the cache

Hi

I need to iterate over all the rows to check something.
When doing this, I saw memory consumption raising infinitely.
Then I remembered that sqlobjects caches everything.
Then I tried:

for a in SOClass.select():
  connection.cache.clear()

memory is still growing.
Is it a python problem or a SQLObject problem?
What do you suggest for this?

Thanks

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
Sam's Lists | 19 Aug 02:55

Support for point data types in postgresql

Hi...

I'm just beginning to explore the world of spatial database functions.  Is there any special support for the point data type in sqlobject (using Postgres), or am I pretty much on my own?

Thanks
Sam
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Gmane