You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote a simple script to import the seed data in a cluster environment, where psql was not included the docker container running the web app. It inherits the various DB_* environment variables. It might be worth including something similar in jhe/scripts/. Since it is part of the app's deployment and not the app itself, I didn't feel confident in creating a PR for it. So just for your consideration...
importosimportpsycopg2# Database connection parametersdb_params= {
'dbname': os.environ.get('DB_NAME'),
'user': os.environ.get('DB_USER'),
'password': os.environ.get('DB_PASSWORD'),
'host': os.environ.get('DB_HOST'),
'port': os.environ.get('DB_PORT', 5432)
}
# Connect to the databaseconn=psycopg2.connect(**db_params)
conn.autocommit=Truecursor=conn.cursor()
# Read and execute the SQL filewithopen('/app/seed.sql', 'r') assql_file:
sql_commands=sql_file.read()
# Execute the SQL commandscursor.execute(sql_commands)
# Close the connectioncursor.close()
conn.close()
print("Seed data imported successfully.")
The text was updated successfully, but these errors were encountered:
I wrote a simple script to import the seed data in a cluster environment, where
psql
was not included the docker container running the web app. It inherits the variousDB_*
environment variables. It might be worth including something similar injhe/scripts/
. Since it is part of the app's deployment and not the app itself, I didn't feel confident in creating a PR for it. So just for your consideration...The text was updated successfully, but these errors were encountered: