Created
June 23, 2020 22:00
-
-
Save Ramko9999/ad6970ed04b3c3010ae940d7b93b9e09 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
TXT_PATH = "" | |
QUERY_PATH = "" | |
text = "" | |
queries = [] | |
with open(TXT_PATH, "r") as f: | |
text = f.read().strip() | |
queries = list(map(lambda x: x.strip(), text.split("CREATE QUERY"))) | |
queries = queries[1:] | |
os.chdir(QUERY_PATH) | |
for query in queries: | |
j = query.index("(") | |
name = query[:j].strip() | |
query = f"DROP QUERY {name} \n CREATE " + query + f" \n INSTALL QUERY {name}" | |
with open(f'{name}.gsql', "w") as f: | |
f.write(query) | |
print(name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment