No Column error

79 views
Skip to first unread message

Maurice Waka

unread,
Nov 26, 2019, 4:46:49 AM11/26/19
to web2py-users
Using python3,
I added the extra fields on auth_user using this code:

auth.settings.extra_fields['auth_user']=[
   
Field('gender',requires=IS_IN_SET(('Male','Female'))),
   
Field('city',requires=IS_NOT_EMPTY()),
   
Field('country',requires=IS_NOT_EMPTY()),
   
Field('phoneNo',requires=IS_NOT_EMPTY()),
   
Field('pic','upload',requires=IS_NOT_EMPTY()),
   
Field('spams','integer',readable=False,writable=False,default=0),
   
Field('premium',requires=IS_IN_SET(('0','1')),readable=False,writable=False,default='0')
]


But I keep getting this errors on sqlite and postgresql:

<class 'sqlite3.OperationalError'> no such column: auth_user.gender




What could be the problem as this was working few days ago till I updated ubuntu yesterday but didn't change any code on web2py
Regards

Maurice Waka

unread,
Nov 26, 2019, 7:48:28 AM11/26/19
to web2py-users
More on this

Traceback

Traceback (most recent call last):
  File "/home/mauricewaka/web2py/gluon/contrib/pg8000/core.py", line 1891, in execute
    ps = cache['ps'][key]
KeyError: ('SELECT "auth_user"."id", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."password", "auth_user"."registration_key", "auth_user"."reset_password_key", "auth_user"."registration_id", "auth_user"."gender", "auth_user"."city", "auth_user"."country", "auth_user"."phoneNo", "auth_user"."pic", "auth_user"."spams", "auth_user"."premium" FROM "auth_user" WHERE ("auth_user"."email" = \'hes...@gmail.com\') LIMIT 1 OFFSET 0;', ())

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mauricewaka/web2py/gluon/restricted.py", line 219, in restricted
    exec(ccode, environment)
  File "/home/mauricewaka/web2py/applications/myappname/controllers/default.py", line 219, in <module>
  File "/home/mauricewaka/web2py/gluon/globals.py", line 421, in <lambda>
    self._caller = lambda f: f()
  File "/home/mauricewaka/web2py/applications/myappname/controllers/default.py", line 84, in user
    return dict(form=auth())
  File "/home/mauricewaka/web2py/gluon/tools.py", line 1801, in __call__
    return getattr(self, args[0])()
  File "/home/mauricewaka/web2py/gluon/tools.py", line 2586, in login
    user = table_user(**{username: entered_username})
  File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/objects.py", line 596, in __call__
    orderby_on_limitby=False).first()
  File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/objects.py", line 2395, in select
    return adapter.select(self.query, fields, attributes)
  File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/base.py", line 763, in select
    return self._select_aux(sql, fields, attributes, colnames)
  File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/base.py", line 719, in _select_aux
    rows = self._select_aux_execute(sql)
  File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/base.py", line 713, in _select_aux_execute
    self.execute(sql)
  File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/__init__.py", line 67, in wrap
    return f(*args, **kwargs)
  File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 203, in execute
    return super(PostgrePG8000, self).execute(*args, **kwargs)
  File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/__init__.py", line 67, in wrap
    return f(*args, **kwargs)
  File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/base.py", line 413, in execute
    rv = self.cursor.execute(command, *args[1:], **kwargs)
  File "/home/mauricewaka/web2py/gluon/contrib/pg8000/core.py", line 906, in execute
    self._c.execute(self, operation, args)
  File "/home/mauricewaka/web2py/gluon/contrib/pg8000/core.py", line 1940, in execute
    self.handle_messages(cursor)
  File "/home/mauricewaka/web2py/gluon/contrib/pg8000/core.py", line 2088, in handle_messages
    raise self.error
gluon.contrib.pg8000.core.ProgrammingError: ('ERROR', 'ERROR', '42703', 'column auth_user.gender does not exist', '219', 'parse_relation.c', '3293', 'errorMissingColumn', '', '')

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/iuaK65yJjR4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/41dc920e-60a3-423a-834c-3b34a801e391%40googlegroups.com.

Dave S

unread,
Nov 26, 2019, 4:21:08 PM11/26/19
to web...@googlegroups.com


On Tuesday, November 26, 2019 at 4:48:28 AM UTC-8, Maurice Waka wrote:
More on this

Traceback

Traceback (most recent call last):
  File "/home/mauricewaka/web2py/gluon/contrib/pg8000/core.py", line 1891, in execute
    ps = cache['ps'][key]

You're using pg8000.  That has been NOT RECOMMENDED for several years now.  Please try psycopg2.  When I first switched to PostGres, I used pg8000 and there were some strange things that occurred from time to time.  When I figured out how to get psycopg2 going, things worked beautifully.

See <URL:https://groups.google.com/d/msg/web2py/lDjyyWYxRt0/qc_-f8UyAAAJ>

/dps


To unsubscribe from this group and all its topics, send an email to web...@googlegroups.com.

Maurice Waka

unread,
Nov 27, 2019, 11:01:36 AM11/27/19
to web2py-users
I got this error after installing psycopg2



Traceback (most recent call last):
  File "/home/mauricewaka/web2py/gluon/restricted.py", line 219, in restricted
    exec(ccode, environment)
  File "/home/mauricewaka/web2py/applications/myappname/controllers/default.py", line 219, in <module>
  File "/home/mauricewaka/web2py/gluon/globals.py", line 421, in <lambda>
    self._caller = lambda f: f()
  File "/home/mauricewaka/web2py/applications/myappname/controllers/default.py", line 84, in user
    return dict(form=auth())
  File "/home/mauricewaka/web2py/gluon/tools.py", line 1801, in __call__
    return getattr(self, args[0])()
  File "/home/mauricewaka/web2py/gluon/tools.py", line 2586, in login
    user = table_user(**{username: entered_username})
  File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/objects.py", line 596, in __call__
    orderby_on_limitby=False).first()
  File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/objects.py", line 2395, in select
    return adapter.select(self.query, fields, attributes)
  File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/base.py", line 763, in select
    return self._select_aux(sql, fields, attributes, colnames)
  File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/base.py", line 719, in _select_aux
    rows = self._select_aux_execute(sql)
  File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/base.py", line 713, in _select_aux_execute
    self.execute(sql)
  File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/__init__.py", line 67, in wrap
    return f(*args, **kwargs)
  File "/home/mauricewaka/web2py/gluon/packages/dal/pydal/adapters/base.py", line 413, in execute
    rv = self.cursor.execute(command, *args[1:], **kwargs)
psycopg2.ProgrammingError: column auth_user.gender does not exist
LINE 1: ...set_password_key", "auth_user"."registration_id", "auth_user...
                                                             ^


On Wed, Nov 27, 2019 at 12:21 AM Dave S <snide...@gmail.com> wrote:


On Tuesday, November 26, 2019 at 4:48:28 AM UTC-8, Maurice Waka wrote:
More on this

Traceback

Traceback (most recent call last):
  File "/home/mauricewaka/web2py/gluon/contrib/pg8000/core.py", line 1891, in execute
    ps = cache['ps'][key]

You're using pg8000.  That has been NOT RECOMMENDED for several years now.  Please try psycopg2.  When I first switched to PostGres, I used pg8000 and there were some strange things that occurred from time to time.  When I figured out how to get psycopg2 going, things worked beautifully.



To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/4a9b609d-bf71-484c-9750-bf3ff6255efa%40googlegroups.com.

Lovedie JC

unread,
Nov 29, 2019, 4:06:01 AM11/29/19
to web...@googlegroups.com
I think my error was due to a reserved name. I had a field called timestamp that was leading to the error.
Now works well. 

You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CALkNK56QcJjomHqXY6_uh8hhRHEfz6iZ1iwvE29xqrSuTwxO9g%40mail.gmail.com.

Dave S

unread,
Nov 29, 2019, 11:45:29 PM11/29/19
to web2py-users


On Friday, November 29, 2019 at 1:06:01 AM UTC-8, Lovedie JC wrote:
I think my error was due to a reserved name. I had a field called timestamp that was leading to the error.
Now works well. 

Ah! Did you use r_name to fix things, or a more thorough change?

/dps
 

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CALkNK56QcJjomHqXY6_uh8hhRHEfz6iZ1iwvE29xqrSuTwxO9g%40mail.gmail.com.

Lovedie JC

unread,
Nov 30, 2019, 3:11:34 AM11/30/19
to web...@googlegroups.com
Yes I did. Thanks for the help 

To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/c0cb5b6f-9292-4817-b4f2-a6b29827b4be%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages