#193 Capital letters in table/column names

closed-wont-fix
Postgres (36)
5
2006-08-22
2006-08-16
No

Postgre requires table names, column names and so on
to be enclosed in double quotes if they contain
capital letters. Otherwise it assumes that they are
all lower-case. In order to be more DBMS-agnostic,
SQLObject should deal with that.

It is possible to do something like:
lastName = StringCol(dbName='"lastName"')

It would be nicer to be able to do this:
lastName = StringCol(dbName='lastName')

The current solution is error-prone. Also, when doing
this, it get's a bit confusing as you have to leave
out the quotes when doing joins:

wrong:
address = SingleJoin('"Address"')
correct:
address = SingleJoin('Address')

as the joins relate to Python objects, not directly to
tables.

I have to deal with this, as I am migrating a web-
application from PHP to Python, and the database
already exists and modifying it is not an option.

Best regards,

Michel Albert

Discussion

  • Nobody/Anonymous

    Logged In: NO

    This issue actually *breaks* postgres!:

    --- In postgres: -----------------------------------
    database=> SELECT NEXTVAL('"Hotel_idHotel_seq"');
    nextval
    ---------
    1
    (1 row)
    ----------------------------------------------------

    --- Using SQLObject --------------------------------
    >>> x = Hotel(name="foo", address=None, owner=None,
    establishment=None)
    Traceback (most recent call last):
    File "<console>", line 1, in ?
    File "/usr/lib/python2.4/site-packages/SQLObject-
    0.7.1dev_r1675-py2.4.egg/sqlobject/declarative.py", line
    92, in _wrapper
    return_value = fn(self, *args, **kwargs)
    File "/usr/lib/python2.4/site-packages/SQLObject-
    0.7.1dev_r1675-py2.4.egg/sqlobject/main.py", line 1197, in
    __init__
    self._create(id, **kw)
    File "/usr/lib/python2.4/site-packages/SQLObject-
    0.7.1dev_r1675-py2.4.egg/sqlobject/main.py", line 1224, in
    _create
    self._SO_finishCreate(id)
    File "/usr/lib/python2.4/site-packages/SQLObject-
    0.7.1dev_r1675-py2.4.egg/sqlobject/main.py", line 1248, in
    _SO_finishCreate
    id, names, values)
    File "/usr/lib/python2.4/site-packages/SQLObject-
    0.7.1dev_r1675-py2.4.egg/sqlobject/dbconnection.py", line
    759, in queryInsertID
    return self._dbConnection._queryInsertID(
    File "/usr/lib/python2.4/site-packages/SQLObject-
    0.7.1dev_r1675-py2.4.egg/sqlobject/postgres/
    pgconnection.py", line 126, in _queryInsertID
    c.execute("SELECT NEXTVAL('%s')" % sequenceName)
    ProgrammingError: ERROR: invalid name syntax

    SELECT NEXTVAL('"Hotel"_"idHotel"_seq')
    ----------------------------------------------------

     
  • Oleg Broytman

    Oleg Broytman - 2006-08-22

    Logged In: YES
    user_id=4799

    Use sqlmeta.idSequence to name your sequence.

     
  • Oleg Broytman

    Oleg Broytman - 2006-08-22
    • status: open --> closed
     
  • Oleg Broytman

    Oleg Broytman - 2006-08-22
    • assigned_to: nobody --> phd
    • status: closed --> closed-wont-fix
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks