(dburl, echo, num)
| 29 | |
| 30 | @Profiler.setup |
| 31 | def setup_database(dburl, echo, num): |
| 32 | global engine |
| 33 | engine = create_engine(dburl, echo=echo) |
| 34 | Base.metadata.drop_all(engine) |
| 35 | Base.metadata.create_all(engine) |
| 36 | |
| 37 | s = Session(engine) |
| 38 | for chunk in range(0, num, 10000): |
| 39 | s.bulk_insert_mappings( |
| 40 | Customer, |
| 41 | [ |
| 42 | { |
| 43 | "name": "customer name %d" % i, |
| 44 | "description": "customer description %d" % i, |
| 45 | } |
| 46 | for i in range(chunk, chunk + 10000) |
| 47 | ], |
| 48 | ) |
| 49 | s.commit() |
| 50 | |
| 51 | |
| 52 | @Profiler.profile |
nothing calls this directly
no test coverage detected