(conn, iris_file: Path)
| 184 | |
| 185 | |
| 186 | def create_and_load_iris(conn, iris_file: Path): |
| 187 | from sqlalchemy import insert |
| 188 | |
| 189 | iris = iris_table_metadata() |
| 190 | |
| 191 | with iris_file.open(newline=None, encoding="utf-8") as csvfile: |
| 192 | reader = csv.reader(csvfile) |
| 193 | header = next(reader) |
| 194 | params = [dict(zip(header, row)) for row in reader] |
| 195 | stmt = insert(iris).values(params) |
| 196 | with conn.begin() as con: |
| 197 | iris.drop(con, checkfirst=True) |
| 198 | iris.create(bind=con) |
| 199 | con.execute(stmt) |
| 200 | |
| 201 | |
| 202 | def create_and_load_iris_view(conn): |
no test coverage detected