in progress: python scripting for database population and management

This commit is contained in:
Mikayla Dobson
2022-09-22 18:19:59 -05:00
parent bf15b8871d
commit 2e8a811659
5 changed files with 153 additions and 0 deletions

21
db/util/main.py Normal file
View File

@@ -0,0 +1,21 @@
import psycopg2
import os
# read data from environment if present
path = "../../.env"
fd = os.open(path, os.O_RDONLY)
n = 300
file_data = os.read(fd, n)
parsed_string = ""
# convert each ASCII value to its corresponding character
for c in file_data:
parsed_string = parsed_string + chr(c)
start = parsed_string.find('postgres')
end = parsed_string.find('EXPRESS')
# receive conn string from env
constring = parsed_string[start:end]
os.close(fd)