# Connect to a local postgres instance
db = DAL("postgres://user@localhost/DBName")
# Create some fields ...
_parent = Field('parent', type='integer' )
_name = Field('name', type='string' )
_author = Field('author', type='string' )
_created = Field('created', type='datetime' )
# Create a table from those fields
db.define_table( 'project_common', _parent, _name, _author, _created )
# Insert or Update the row
db.project_common.update_or_insert( \
db.project_common.id == _id, \
parent = _parent, \
name = _name, \
author = _author, \
created = _create )
At run-time the update_or_insert statement fails claiming ...
... AttributeError: 'DAL' object has no attribute 'project_common'
I am a bit confused because this looks like it is straight out of the documentation. Do I have to re-create the define_table statement in every file to make it work. I can successfully run executesql() statements all day long against the db object, but that locks me into the SQL syntax of my backend DB. I want to use DAL for all that it offers, but I am missing something fundamental. Is there a common mistake newbies make.