File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ def postgres_create_database():
1010    when using postgres database, this is the function that is used to 
1111    create the database for the first time when you the nettacker run module. 
1212    """ 
13- 
1413    try :
1514        engine  =  create_engine (
1615            "postgresql+psycopg2://{username}:{password}@{host}:{port}/{name}" .format (
@@ -21,15 +20,14 @@ def postgres_create_database():
2120    except  OperationalError :
2221        # if the database does not exist 
2322        engine  =  create_engine (
24-             "postgresql+psycopg2://{username}:{password}@{host}:{port}/{name} " .format (
23+             "postgresql+psycopg2://{username}:{password}@{host}:{port}/postgres " .format (
2524                ** Config .db .as_dict ()
2625            )
2726        )
2827        conn  =  engine .connect ()
29-         conn . execute ( "commit " )
28+         conn   =   conn . execution_options ( isolation_level = "AUTOCOMMIT " )
3029        conn .execute (text (f"CREATE DATABASE { Config .db .name }  " ))
3130        conn .close ()
32- 
3331        engine  =  create_engine (
3432            "postgresql+psycopg2://{username}:{password}@{host}:{port}/{name}" .format (
3533                ** Config .db .as_dict ()
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments