(self)
| 22 | clear_mappers() |
| 23 | |
| 24 | def test_with_polymorphic(self): |
| 25 | metadata = MetaData() |
| 26 | |
| 27 | order = Table( |
| 28 | "orders", |
| 29 | metadata, |
| 30 | Column("id", Integer, primary_key=True), |
| 31 | Column( |
| 32 | "employee_id", |
| 33 | Integer, |
| 34 | ForeignKey("employees.id"), |
| 35 | nullable=False, |
| 36 | ), |
| 37 | Column("type", Unicode(16)), |
| 38 | ) |
| 39 | |
| 40 | employee = Table( |
| 41 | "employees", |
| 42 | metadata, |
| 43 | Column("id", Integer, primary_key=True), |
| 44 | Column("name", Unicode(16), unique=True, nullable=False), |
| 45 | ) |
| 46 | |
| 47 | product = Table( |
| 48 | "products", metadata, Column("id", Integer, primary_key=True) |
| 49 | ) |
| 50 | |
| 51 | orderproduct = Table( |
| 52 | "orderproducts", |
| 53 | metadata, |
| 54 | Column("id", Integer, primary_key=True), |
| 55 | Column( |
| 56 | "order_id", Integer, ForeignKey("orders.id"), nullable=False |
| 57 | ), |
| 58 | Column( |
| 59 | "product_id", |
| 60 | Integer, |
| 61 | ForeignKey("products.id"), |
| 62 | nullable=False, |
| 63 | ), |
| 64 | ) |
| 65 | |
| 66 | class Order: |
| 67 | pass |
| 68 | |
| 69 | class Employee: |
| 70 | pass |
| 71 | |
| 72 | class Product: |
| 73 | pass |
| 74 | |
| 75 | class OrderProduct: |
| 76 | pass |
| 77 | |
| 78 | order_join = order.select().alias("pjoin") |
| 79 | |
| 80 | self.mapper_registry.map_imperatively( |
| 81 | Order, |
nothing calls this directly
no test coverage detected