Loading all tables complete
This commit is contained in:
parent
01ae8c9ffb
commit
1040a18545
|
@ -92,6 +92,18 @@ class DDB:
|
||||||
.fetchall()[0][0]
|
.fetchall()[0][0]
|
||||||
.split(";")
|
.split(";")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Load all the tables into the database
|
||||||
|
for sheet in self.sheets:
|
||||||
|
self.db.query(f"""
|
||||||
|
create table {sheet} as (
|
||||||
|
select
|
||||||
|
*
|
||||||
|
from
|
||||||
|
read_csv_auto('{path}/{sheet}.csv')
|
||||||
|
)
|
||||||
|
""")
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def load_folder_gcs(self, path: str) -> Self:
|
def load_folder_gcs(self, path: str) -> Self:
|
||||||
|
|
Binary file not shown.
|
@ -19,4 +19,8 @@ def test_dump():
|
||||||
|
|
||||||
def test_load():
|
def test_load():
|
||||||
db = DDB().load_folder_local(TEST_OUTPUT_FOLDER)
|
db = DDB().load_folder_local(TEST_OUTPUT_FOLDER)
|
||||||
|
|
||||||
|
results = db.query("select * from answers").fetchall()
|
||||||
|
|
||||||
assert db.sheets == ("answers",)
|
assert db.sheets == ("answers",)
|
||||||
|
assert len(results) == 2
|
||||||
|
|
Loading…
Reference in a new issue