db.define_table('abnvalinterprets',
Field('abnvalinterpret', length= 1000000),)
from gluon import current, DAL, Fielddef abnvalinterpret():
db = current.db
db.define_table('abnvalinterprets',Field('abnvalinterpret', 'text', length=1000000))
rows = db().select(db.abnvalinterprets.abnvalinterpret.ALL)
for row in rows:
print row.abnvalinterpret
abnvalinterpret()
line 4, in abnvalinterpret
db = current.db
AttributeError: 'thread._local' object has no attribute 'db'
from this link, i tried accessing values in db as follows:model:
db.define_table('abnvalinterprets',
Field('abnvalinterpret', length= 1000000),)Module:
from gluon import current, DAL, Field
def abnvalinterpret():
db = current.db
db.define_table('abnvalinterprets',Field('abnvalinterpret', 'text', length=1000000))
rows = db().select(db.abnvalinterprets.abnvalinterpret.ALL)
for row in rows:
print row.abnvalinterpret
abnvalinterpret()I keep getting this error:
line 4, in abnvalinterpret
db = current.db
AttributeError: 'thread._local' object has no attribute 'db'Am testing if my module can access/print out data from the database. I hope that is the correct function too.Regards
--
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/wBVbeSdbc9o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sorry, am still experiencing the same issue.This module is one of the many that I import to the controller .i.e.controller:from gluon import currentdb = current.db
current.db = db
current.globalenv['db']
--
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/wBVbeSdbc9o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.