#164 Can't access column called 'class' in SQLObject

closed-wont-fix
nobody
General (125)
5
2006-04-05
2006-03-27
Anonymous
No

A syntax error is generated when a column named "class"
is accessed using the SQLObject class interface in
SQLObject 0.7.

Example:

The class AltJEDic contains a column named "CLASS" that
should be mapped to the python object AltJEDic.class

class AltJEDic(SQLObject):
class sqlmeta:
fromDatabase = True
#idName = "sqlid"
table = "ALTJEDIC0111"
style = HinokiStyle()

However, when I try to use AltJEDic.class in a function
call, it fails with the following error:

# python verify-wordnet.py
File "verify-wordnet.py", line 190
if isSynonymRelGT(left_altjdic.class,
right_altjdic.class):
^
SyntaxError: invalid syntax

It seems that this is interfering with Python keywords.
Do we need to add a restriction on column (or SQLObject
class member names) or can this be worked around?

Discussion

  • Nobody/Anonymous

    Logged In: NO

    I forgot to add some context. I get left_altjdic and
    right_altjdic by taking the first items from the results of
    selectBy() queries as follows:

    left_altjdics = AltJDic.selectBy(entry=left)
    left_altjdic = left_altjdics[0]
    try:
    right_altjdics = AltJDic.selectBy(entry=right)
    right_altjdic = right_altjdics[0]
    if isSynonymRelGT(left_altjdic.class, right_altjdic.class):

     
  • Nobody/Anonymous

    Logged In: NO

    I forgot to add some context. I get left_altjdic and
    right_altjdic by taking the first items from the results of
    selectBy() queries as follows:

    left_altjdics = AltJDic.selectBy(entry=left)
    left_altjdic = left_altjdics[0]
    try:
    right_altjdics = AltJDic.selectBy(entry=right)
    right_altjdic = right_altjdics[0]
    if isSynonymRelGT(left_altjdic.class, right_altjdic.class):

     
  • Nobody/Anonymous

    Logged In: NO

    I forgot to add some context. I get left_altjdic and
    right_altjdic by taking the first results from selectBy()
    queries. Ex:

    left_altjdics = AltJDic.selectBy(entry=left)
    left_altjdic = left_altjdics[0]
    try:
    right_altjdics = AltJDic.selectBy(entry=right)
    right_altjdic = right_altjdics[0]
    if isSynonymRelGT(left_altjdic.class, right_altjdic.class):

     
  • Oleg Broytman

    Oleg Broytman - 2006-04-05
    • status: open --> closed-wont-fix
     
  • Oleg Broytman

    Oleg Broytman - 2006-04-05

    Logged In: YES
    user_id=4799

    This a Python restriction but there is a simple workaround:

    gettatr(left_altjdic, "class")

     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks