Closed billingross closed 2 months ago
When defining queries, strings must all be on a single line. For instance, the Cypher string cannot be split over multiple lines or else the yaml module will not read it the query document.
Error:
KeyError: "> db-query: Database query 'relateFastqToReadGroup' is not available. Check that is has been added to config/database-queries.yaml."
Love to see my own error messages. For some reason db-query
is not reading my database queries. From the previous line:
> db-query: Defined queries: dict_keys([]).
Testing the logic locally...
I made a test script. This is the whole script:
#!/usr/bin/env python3
import yaml
import trellisdata
with open("database-queries.yaml", 'r') as file_handle:
queries_document = file_handle.read()
queries = yaml.load_all(queries_document, Loader=yaml.FullLoader)
QUERY_DICT = {}
for query in queries:
QUERY_DICT[query.name] = query
print(QUERY_DICT)
And everything works fine. This is the logic I copy-pasted from db-query
. So now my thought is that either
database-queries.yaml
file is not being updatedI've turned on the DEVELOPMENT
flag for this function so that it gets a new copy of the database-queries.yaml
file every time.
Alright, now I've got a new error so I think it was just an issue of the state not being updated. Turn on DEVELOPMENT
when doing development, noted.
Create queries corresponding to the following triggers: