We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5cd7291 commit fb346deCopy full SHA for fb346de
1 file changed
src/infra/database/populate.py
@@ -1,16 +1,16 @@
1
import os
2
-from src.infra.database.database import PgDatabase
+from src.infra.database.database import PgDatabase, Database
3
4
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
5
6
7
-def populate() -> None:
+def populate(database: Database) -> None:
8
def insert(filePath: str) -> None:
9
sql_file = open(BASE_DIR + filePath, "r")
10
sql = sql_file.read()
11
lines = sql.split(";")
12
13
- with PgDatabase() as db:
+ with database as db:
14
for line in lines:
15
print(line)
16
if line.strip():
@@ -23,4 +23,4 @@ def insert(filePath: str) -> None:
23
24
25
if __name__ == "__main__":
26
- populate()
+ populate(PgDatabase())
0 commit comments