Passing variable value in items.find query using python

49 views Asked by At

I am unable to pass a variable value into the items.find query which is used to get the repo details from artifactory

rep1 = "repo-name"

    aql_query1 = '''
    items.find(
    {"name":{"$match":"manifest.json"}},
    {"repo" :{"$match": "{rep1}" }}).include("repo","name","path","modified").sort({"$asc" : ["modified"]}) 
    '''

the rep1 variable consists of repo-name and this should be passed to the items.find query into {"repo" :{"$match": "{rep1}" }

im trying to achieve this using python script

1

There are 1 answers

0
who-cares2023 On BEST ANSWER
rep1 = "repo-name"

aql_query1 = f'''
items.find(
    {{"name": {{"$match": "manifest.json"}}}},
    {{"repo": {{"$match": "{rep1}"}}}}
).include("repo", "name", "path", "modified").sort({{"$asc": ["modified"]}})
'''

print(aql_query1)