ldo/ShaderTools — comment on commit 53c5963d10c0d99e0c42e3f9a9d8e70d9839d4eb
File:  line 0
By ldo:

To start with, see how I do the database lookups. The lowest-level query function is SQLIter, but you might not appreciate the usefulness of that right now. Instead, look at the next one, GetEachRecord. This one takes a list of field names, constructs a query, and returns the matching records one at a time. Notice the expression

dict(zip(Fields, Row))

What this does is construct a dict which maps the field names to the corresponding field values, so you can fetch the values by name rather than by ordering. For example, compare how the ImporterSQL routine retrieves the fields from the IMAGE_UV table: in the original version, there is a counter c, and the fields have to be individually identified by the value of this counter and assigned to a large bunch of variables:

if c == 2:
Tex_ima_name = values2
if c == 4:
Tex_ima_filepath = values2

whereas in my version, they can be directly accessed in the returned record as ThisImage["Ima_Name"], ThisImage["Ima_Filepath"] and so on.