Thanks Anthony,

I'm trying to create a user named table, using company_accounts_db as
a variable.

Prior to the select I defined and created a user named table by using
the variable company_accounts_db. User_id 8 enters a company name
within a form. The form input is used to define the variable db name
by:  company_accounts_db = company_name + '_accounts_' +
str(auth.user_id)
In this case, user_8 inputs for company name, BIGkittyBIG.(sorry for
the goofy name but its easy to spot in the directory) Then the table
is created with:

db.define_table( company_accounts_db,
                                    Field('name'),
                                    Field('owner'),
                                    Field('plan'),
                                    Field('actual'),
                                    Field('status'))

after this, ..hashcode..._BIGkittyBIG_accounts_8.table is in the
application/database folder. This table seems to update ok. After
creating the table ..._BIGkittyBIG_accounts_8.table, I insert about 20
records. This appears to work just as expected. I open storage.sqlite
with notepadd++ and I see what looks like all the added records.
Access to the ...accounts_8.table is not available through the admin
interface.

any other thoughts? James C.


On May 10, 2:23 pm, Anthony <abasta...@gmail.com> wrote:
> On Tuesday, May 10, 2011 4:01:34 PM UTC-4, james c. wrote:
>
> > I am having trouble with a key exception error.  The problem is
> > occuring when the controller tries to read a database defined earlier
> > in the controller. The Error Message is occurring here:
>
> >     company_name = 'BIGkittyBIG'
> >     company_accounts_db = company_name + '_accounts_' +
> > str(auth.user_id)
> >     rows = db(db[company_accounts_db].name != None).select()
>
> db[company_accounts_db] is expecting a db table with the name
> company_accounts_db -- but in your code, it doesn't look like you defined
> such a table. To do so, you would need db.define_table(company_accounts_db,
> ...) somewhere.
>
> Anthony

Reply via email to