daily pastebin goal
30%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  23 def restore_dump(dump, dest_db):
  2.  24     """restore src (dumpfile) to dest (name of database)"""
  3.  25     if DEBUG: logging.debug('restore_dump invoked with {} and {}'.format(dump, dest_db))
  4.  26     popen = subprocess.Popen(['psql', '-U', 'postgres', '-c', 'CREATE DATABASE provisioning'], stdout=subprocess.PIPE, universal_newlines=True
  5.     )
  6.  27     print popen.communicate()
  7.  28     popen.stdout.close()
  8.  
  9.  
  10.  
  11.  38 def main():
  12.  39     parser = argparse.ArgumentParser()
  13.  40 #    parser.add_argument('dest_db', metavar='DB', type=str, help='The name of the database to restore')
  14.  41     parser.add_argument('-r', '--restore', dest='restoredbname',action='store_const', const=restore_dump, help='Restore specified dump file as
  15.     dbname.  Must supply <pathtodumpfile> and <dbname>')
  16.  42     args = parser.parse_args()
  17.  43
  18.  44
  19.  45 if __name__ == '__main__':
  20.  46     main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top