Database reader node returns error when I use variable

Hello,

I have a table containing Uniprot ids and a SQL query. I would like to make run the query for each id.

The ids table is connected to a "tablerow to variable loop start", its flow variable is connected to the "database reader" and the workflow is endend by a "loop end" node.

 

My query is:

 

SELECT protein_family_classification.l2, component_sequences.accession, activities.standard_value, activities.standard_units, activities.standard_type, molecule_dictionary.chembl_id
FROM
protein_family_classification, component_class, component_sequences, target_components, target_dictionary, assays, activities, compound_records, molecule_dictionary
WHERE
protein_family_classification.protein_class_id=component_class.protein_class_id
AND component_class.component_id=component_sequences.component_id
AND component_sequences.component_id=target_components.component_id
AND target_components.tid = target_dictionary.tid
AND target_dictionary.tid = assays.tid
AND assays.assay_id=activities.assay_id
AND activities.record_id = compound_records.record_id
AND compound_records.molregno = molecule_dictionary.molregno
AND component_sequences.accession=$${SUniprotKB}$$;

 

Unfortunately I have this error: Execute failed: Unknown column 'Q2M2I8' in 'where clause'

'Q2M2I8' is the first id in my table.

When I replace $${SUniprotKB}$$ by 'Q2M2I8', it works.

Do you know what may be the problem with my variable? It is not the first time I use variables but it is the first time I get a such error. Moreover why 'Q2M2I8' should be a column when it is an argument?

Nico

 

You must enclose the reference to the flow variable in single quotes (as for every other string). Otherwise SQL indeed treats it as a column reference (accession=Q2M2I8).

I was so used to use integers in my variables that I forgot the basics...

Thank you