@@ -19,6 +19,7 @@ def as_bool(value):
1919def  psql_command (url : Url , command , cmdfile = None , debug = False , sudo = False , db = None ):
2020    if  debug :
2121        print (command )
22+     assert  ":"  in  url .auth , "Please provide the password in the postgres URL." 
2223    user , password  =  url .auth .split (":" , 1 )
2324    host  =  url .hostname 
2425    port  =  url .port 
@@ -84,7 +85,7 @@ def generate_accounts(url, num_accounts, space_id):
8485    ]
8586    result  =  psql_command (
8687        url ,
87-         f"select upsert_accounts_in_space({ space_id }  , ' { dumps (accounts )} ' )" ,
88+         f"select upsert_accounts_in_space({ space_id }  , $json$ { dumps (accounts )} $json$ )" ,
8889        debug = False ,
8990    )
9091    nums  =  [int (i ) for  i  in  result .split ()]
@@ -124,7 +125,7 @@ def make_content():
124125        content  =  [make_content () for  i  in  range (b , min (b  +  500 , target_num ))]
125126        result  =  psql_command (
126127            url ,
127-             f"select upsert_content({ space_id }  , ' { dumps (content )} ' , null);" ,
128+             f"select upsert_content({ space_id }  , $json$ { dumps (content )} $json$ , null);" ,
128129        )
129130        for  i , n  in  enumerate (result .split ()):
130131            content [i ]["id" ] =  int (n )
@@ -150,9 +151,7 @@ def make_concept_schema(name, content, is_relation):
150151            author_id = content ["author_id" ],
151152            represented_by_id = content ["id" ],
152153            is_schema = True ,
153-             literal_content = dict (roles = ["source" , "destination" ])
154-             if  is_relation 
155-             else  dict (),
154+             literal_content = dict (roles = ["source" , "target" ]) if  is_relation  else  dict (),
156155        )
157156
158157    node_schemas  =  [
@@ -166,7 +165,7 @@ def make_concept_schema(name, content, is_relation):
166165    schemata  =  node_schemas  +  relation_schemas 
167166    result  =  psql_command (
168167        url ,
169-         f"select upsert_concepts({ space_id }  , ' { dumps (schemata )} ' );" ,
168+         f"select upsert_concepts({ space_id }  , $json$ { dumps (schemata )} $json$ );" ,
170169    )
171170    nums  =  result .split ()
172171    for  i , schema  in  enumerate (schemata ):
@@ -206,7 +205,7 @@ def make_node(name, content, schema_id):
206205                for  i  in  range (b , local_target_num )
207206            ]
208207            result  =  psql_command (
209-                 url , f"select upsert_concepts({ space_id }  , ' { dumps (nodes )} ' );" 
208+                 url , f"select upsert_concepts({ space_id }  , $json$ { dumps (nodes )} $json$ );" 
210209            )
211210            nums  =  result .split ()
212211            for  i , node  in  enumerate (nodes ):
@@ -257,7 +256,7 @@ def random_node(schema_name):
257256            ]
258257            result  =  psql_command (
259258                url ,
260-                 f"select upsert_concepts({ space_id }  , ' { dumps (relns )} ' );" ,
259+                 f"select upsert_concepts({ space_id }  , $json$ { dumps (relns )} $json$ );" ,
261260            )
262261            nums  =  result .split ()
263262            for  i , reln  in  enumerate (relns ):
0 commit comments