Make queries into a single line

This commit is contained in:
János Benjamin Antal 2023-02-01 14:59:50 +01:00
parent 24ae6069f0
commit 50327254e0

View File

@ -92,9 +92,9 @@ def main():
for index in range(0, number_of_files):
if index != 0:
f.write(",")
f.write(f'\n {{uuid: {uuid}, platformId: "platform_id", name: "name_file_{uuid}"}}')
f.write(f' {{uuid: {uuid}, platformId: "platform_id", name: "name_file_{uuid}"}}')
uuid += 1
f.write("\n] AS props CREATE (:File {uuid: props.uuid, platformId: props.platformId, name: props.name});\n")
f.write("] AS props CREATE (:File {uuid: props.uuid, platformId: props.platformId, name: props.name});\n")
identities = []
f.write("UNWIND [")
@ -102,9 +102,9 @@ def main():
for index in range(0, number_of_identities):
if index != 0:
f.write(",")
f.write(f'\n {{uuid: {uuid}, name: "mail_{uuid}@something.com"}}')
f.write(f' {{uuid: {uuid}, name: "mail_{uuid}@something.com"}}')
uuid += 1
f.write("\n] AS props CREATE (:Identity {uuid: props.uuid, name: props.name});\n")
f.write("] AS props CREATE (:Identity {uuid: props.uuid, name: props.name});\n")
f.write("UNWIND [")
created = 0
@ -120,28 +120,18 @@ def main():
f.write(",")
f.write(
f'\n {{permUuid: {uuid}, permName: "name_permission_{uuid}", fileUuid: {file_uuid}, identityUuid: {identity_uuid}}}'
f' {{permUuid: {uuid}, permName: "name_permission_{uuid}", fileUuid: {file_uuid}, identityUuid: {identity_uuid}}}'
)
created += 1
uuid += 1
if created == 5000:
f.write(
"""\n] AS props
MATCH (file:File {uuid:props.fileUuid}), (identity:Identity {uuid: props.identityUuid})
CREATE (permission:Permission {uuid: props.permUuid, name: props.permName})
CREATE (permission)-[: IS_FOR_FILE]->(file)
CREATE (permission)-[: IS_FOR_IDENTITY]->(identity);
UNWIND ["""
"] AS props MATCH (file:File {uuid:props.fileUuid}), (identity:Identity {uuid: props.identityUuid}) CREATE (permission:Permission {uuid: props.permUuid, name: props.permName}) CREATE (permission)-[: IS_FOR_FILE]->(file) CREATE (permission)-[: IS_FOR_IDENTITY]->(identity);\nUNWIND ["
)
created = 0
f.write(
"""\n] AS props
MATCH (file:File {uuid:props.fileUuid}), (identity:Identity {uuid: props.identityUuid})
CREATE (permission:Permission {uuid: props.permUuid, name: props.permName})
CREATE (permission)-[: IS_FOR_FILE]->(file)
CREATE (permission)-[: IS_FOR_IDENTITY]->(identity);
"""
"] AS props MATCH (file:File {uuid:props.fileUuid}), (identity:Identity {uuid: props.identityUuid}) CREATE (permission:Permission {uuid: props.permUuid, name: props.permName}) CREATE (permission)-[: IS_FOR_FILE]->(file) CREATE (permission)-[: IS_FOR_IDENTITY]->(identity);"
)