(self)
| 307 | raise Exception("Unrecognised engine") |
| 308 | |
| 309 | def insert_row(self): |
| 310 | assert ENGINE is not None |
| 311 | |
| 312 | if ENGINE.engine_type == "cockroach": |
| 313 | id = self.run_sync(""" |
| 314 | INSERT INTO manager ( |
| 315 | name |
| 316 | ) VALUES ( |
| 317 | 'Guido' |
| 318 | ) RETURNING id;""") |
| 319 | self.run_sync(f""" |
| 320 | INSERT INTO band ( |
| 321 | name, |
| 322 | manager, |
| 323 | popularity |
| 324 | ) VALUES ( |
| 325 | 'Pythonistas', |
| 326 | {id[0]["id"]}, |
| 327 | 1000 |
| 328 | );""") |
| 329 | else: |
| 330 | self.run_sync(""" |
| 331 | INSERT INTO manager ( |
| 332 | name |
| 333 | ) VALUES ( |
| 334 | 'Guido' |
| 335 | );""") |
| 336 | self.run_sync(""" |
| 337 | INSERT INTO band ( |
| 338 | name, |
| 339 | manager, |
| 340 | popularity |
| 341 | ) VALUES ( |
| 342 | 'Pythonistas', |
| 343 | 1, |
| 344 | 1000 |
| 345 | );""") |
| 346 | |
| 347 | def insert_rows(self): |
| 348 | assert ENGINE is not None |