Hi,

I have the weirdest of problem. When using mssql, INSERT (via a
session flush) in one of my table fail, but there is no error
description in the exception (None)

The program seems to be alright since when I associate that table (and
the Inventory table)  with a mysql connection, things work

When I get the connected mssql engine and "execute" the insert, it
works too

I am using SA 0.3.8  and before that 0.3.6dev_r2492

Thanks for any help.
    François

Here is the table definition (InventoryItem is the problem), the
Inventory table works fine

blInventory=Table("Inventory",
    Column("id", Integer, primary_key=True),
    Column("Stock",PaddedIntString(2),ForeignKey("Store.StoreNo")),
    Column("Start", Date, nullable=False),
    Column("End", Date, nullable=True),
    Column("is_Spotcheck", Boolean, nullable=False),
    Column("Leader", String(32), nullable=False))

tblInventoryItem=Table("InventoryItem",
    Column("id", Integer, primary_key=True),
    Column("Inventory",Integer,ForeignKey("Inventory.id"),
nullable=False),
    Column("Product",String(20),ForeignKey("Product.ProductCode"),
nullable=False),
    Column("ExpectedQ", Integer, nullable=False),
    Column("CountedQ", Integer, default=0))


class InventoryItem(DBObject):
    """The result of an inventory for a given product
    """
    pass

class Inventory(DBObject):
    """An inventory either full or spotcheck
    """
    def __repr__(self):
        if self.is_Spotcheck:
            return "%s inventory spot check on %s"%(str(self.Stock),
self.Start.strftime("%d/%m/%Y"))
        else:
            return "%s inventory on %s"%(str(self.Stock),
self.Start.strftime("%d/%m/%Y"))


InventoryItem.mapper["Primary"]=mapper(InventoryItem,
tblInventoryItem, properties={
        '_Inventory':tblInventoryItem.c.Inventory,
        '_Product': tblInventoryItem.c.Product,
        'Product': relation(Product)
        }
)

Inventory.mapper["Primary"]=mapper(Inventory, tblInventory,
properties={
    "_Stock":tblInventory.c.Stock,
    "Stock":relation(Stock),
    "Inventory":relation(InventoryItem, lazy=True,
backref="Inventory", cascade="all, delete-orphan")
    }
)

Note that I have no problem inserting records in the Inventory
table....

The log is

(Model->MakerCost)
(Product->InventoryItem)
(Model->Product)
(Stock->Inventory)
(Inventory->InventoryItem)
(Stock->StockItem)
(Colour->Product)
2007-06-28 17:35:06,981 DEBUG Dependency sort:
Mapper|Stock|Store
  Mapper|Inventory|Inventory
    Mapper|Model|Model
      Mapper|Colour|Color
        Mapper|Product|Product
          Mapper|InventoryItem|InventoryItem
      Mapper|MakerCost|MakerCost
  Mapper|StockItem|Stkdetl

2007-06-28 17:35:06,984 INFO Task dump:

 UOWTask(0x1446650, Stock/Store/None) (save/update phase)
   |   |- Process [EMAIL PROTECTED]
   |
   |- UOWTask(0x1446510, Inventory/Inventory/None) (save/update phase)
   |   |- Save [EMAIL PROTECTED]
   |   |   |- Process [EMAIL PROTECTED]
   |   |   |- Process [EMAIL PROTECTED]
   |   |
   |   |- UOWTask(0x1446350, Model/Model/None) (save/update phase)
   |   |   |
   |   |   |- UOWTask(0x1446210, Colour/Color/None) (save/update
phase)
   |   |   |   |
   |   |   |   |- UOWTask(0x14460d0, Product/Product/None) (save/
update phase)
   |   |   |   |   |   |- Process [EMAIL PROTECTED]
   |   |   |   |   |
   |   |   |   |   |- UOWTask(0x1446110, InventoryItem/InventoryItem/
None) (save/update phase)
   |   |   |   |   |   |- Save [EMAIL PROTECTED]
   |   |   |   |   |   |----
   |   |   |   |   |
   |   |   |   |   |----
   |   |   |   |
   |   |   |   |----
   |   |   |
   |   |   |
   |   |   |- UOWTask(0x1446c90, MakerCost/MakerCost/None) (save/
update phase)
   |   |   |   |- (empty task)
   |   |   |
   |   |   |----
   |   |
   |   |----
   |
   |
   |- UOWTask(0x14467d0, StockItem/Stkdetl/None) (save/update phase)
   |   |- (empty task)
   |
   |
   |- UOWTask(0x1446510, Inventory/Inventory/None) (delete phase)
   |   |
   |   |- UOWTask(0x1446350, Model/Model/None) (delete phase)
   |   |   |
   |   |   |- UOWTask(0x1446210, Colour/Color/None) (delete phase)
   |   |   |   |
   |   |   |   |- UOWTask(0x14460d0, Product/Product/None) (delete
phase)
   |   |   |   |   |
   |   |   |   |   |- UOWTask(0x1446110, InventoryItem/InventoryItem/
None) (delete phase)
   |   |   |   |   |   |----
   |   |   |   |   |
   |   |   |   |   |----
   |   |   |   |
   |   |   |   |----
   |   |   |
   |   |   |
   |   |   |- UOWTask(0x1446c90, MakerCost/MakerCost/None) (delete
phase)
   |   |   |   |- (empty task)
   |   |   |
   |   |   |----
   |   |
   |   |----
   |
   |
   |- UOWTask(0x14467d0, StockItem/Stkdetl/None) (delete phase)
   |   |- (empty task)
   |
   |----


2007-06-28 17:35:06,991 INFO INSERT INTO [InventoryItem] ([Inventory],
[Product], [ExpectedQ], [CountedQ]) VALUES (%(Inventory)s, %
(Product)s, %(ExpectedQ)s, %(CountedQ)s)
2007-06-28 17:35:06,991 INFO {'ExpectedQ': 0, 'Product':
'KK##-0045-13-3405', 'Inventory': 52, 'CountedQ': 10}
2007-06-28 17:35:06,992 INFO ROLLBACK


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to