billingross / trellis-v2

MIT License
0 stars 0 forks source link

Create sample database queries #23

Closed billingross closed 2 months ago

billingross commented 2 months ago

Create queries corresponding to the following triggers:

billingross commented 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.

billingross commented 2 months ago

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...

billingross commented 2 months ago

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

I've turned on the DEVELOPMENT flag for this function so that it gets a new copy of the database-queries.yaml file every time.

billingross commented 2 months ago

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.