This line

if 'P4Sync' in pTable:

will never work. What is it supposed to do?

On Nov 21, 10:39 pm, mart <[email protected]> wrote:
> Hi,
>
> I need to create some tables dynamically (SQLite). Creating them is
> fine, but when comes time to use, well that just isn't working...
>
> I'm doing this to for some automation where I don't know in advance
> how many tables will be created or even what they will be called...
>
> I tried a few things, but i don't think we can use variables when
> referencing tables?
>
> For example, if I do something simple like:
>
> lets say I'm looking for tables that contain sync logs, where the
> dynamically created table name would be named using a defined
> structure like <name>P4<taskName>  (i.e. coreP4sync).
>
> I can do :
>
> define_table("{0}{1}{2}".format(name,repoType,task),
>                                         Field('fileName'),
>                                         Field('fileSize','integer'))
>
> So, I may end up any number of of these tables. How can I simply look
> up the table names, see if any of them match the pattern, then do
> stuff accordingly?
>
> seems that something like below would never work?:  Is there a work
> around?
>
> for pTable in db.tables:
>    if 'P4Sync' in pTable:
>       if string.split(pTable,'P4')[0] == 'core':
>           db(db.pTable.id > 0) blablablabla ....
>
> Thanks,
> Mart :)

Reply via email to