|
17 | 17 | Column('orderid', String(255)), |
18 | 18 | ) |
19 | 19 |
|
20 | | -products = Table( |
21 | | - 'products', metadata, |
22 | | - Column('sku', String(255), primary_key=True), |
23 | | - Column('version_number', Integer, nullable=False, server_default='0'), |
24 | | -) |
25 | | - |
26 | 20 | batches = Table( |
27 | 21 | 'batches', metadata, |
28 | 22 | Column('id', Integer, primary_key=True, autoincrement=True), |
29 | 23 | Column('reference', String(255)), |
30 | | - Column('sku', ForeignKey('products.sku')), |
| 24 | + Column('sku', String(255)), |
31 | 25 | Column('_purchased_quantity', Integer, nullable=False), |
32 | 26 | Column('eta', Date, nullable=True), |
33 | 27 | ) |
|
42 | 36 |
|
43 | 37 | def start_mappers(): |
44 | 38 | lines_mapper = mapper(model.OrderLine, order_lines) |
45 | | - batches_mapper = mapper(model.Batch, batches, properties={ |
| 39 | + mapper(model.Batch, batches, properties={ |
46 | 40 | '_allocations': relationship( |
47 | 41 | lines_mapper, |
48 | 42 | secondary=allocations, |
49 | 43 | collection_class=set, |
50 | 44 | ) |
51 | 45 | }) |
52 | | - mapper(model.Product, products, properties={ |
53 | | - 'batches': relationship(batches_mapper) |
54 | | - }) |
0 commit comments