Alright, .... just about ready to give up! ;)

I have probably been on this subject a little longer than should
but... anyways, last time, promise (probably ;) )


So, tried many different things,  many from suggestions I got here (so
thanks for that)... But somehow... it doesn't feel right. I just keep
thinking "yeah, but making a connection would be best...).

So, I understand that the dal connection learns about the tables from
the model, and maybe its just me, but my "db" reference to dal  don't
seem to  make the best student's?

I'm hoping, someone may have a few tricks if I ask the question in
reverse. If it won't learn about the tables  how would we go about
teaching it about the tables?

I read somewhere that creating an Identity column would letme make
that connection.... so does anybody have the scoop on that one? how
does DAL create an new ID column? Or am I missing something?

I can get the information by invoking sqlite3 directly. I can do
something the following and get info o the DB. Is there a way to take
that and teach the DAL about the DB?

** as another option, would I have the same "can't see the tables"
problem with mysql?


Any help is appreciated :)
Thanks,
Mart :)

import sqlite3

mdb = '{0}/storage.sqlite'.format(dbBlueObj.dbStorage)
conn = sqlite3.connect(mdb)
c = conn.cursor()

# column names
col_name_list = [tuple[0] for tuple in c.description]
print('col_name_list: {0}'.format(col_name_list))
>>>    ;col_name_list: ['id', 'uuid', 'cmdSet', 'cmdEnabled', 'cmdName', 
>>> 'pyModule', etc.....

# select *
t = ('False',)
x = c.execute('select * from data')# where cmdEnabled=?', t)
for item in x:
    print('item: {0}'.format(item))
    >>>  item: (1, u'5c54126f-46c7-4f67-abe5-47a772c97f7d',
u'dev_compile', u'False', u'initBuild',
u'blueLite.pyModules.cmdInit',  etc..........


# from sqlite_master
y = c.execute('SELECT * FROM sqlite_master')
for item in y:
    print('y: {0}'.format(item))
    >>> y: (u'table', u'resolved', u'resolved', 2, u'CREATE TABLE
resolved(\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    uuid
CHAR(64),\n    name CHAR(512),\n    value CHAR(512)\n)')
y: (u'table', u'sqlite_sequence', u'sqlite_sequence', 3, u'CREATE
TABLE sqlite_sequence(name,seq)')
.......

#  this was supposed to give me something, but returns None.... oh
well...
mID = c.lastrowid
    print('mID: {0}'.format(mID))
    >>> None

Reply via email to