I have a model that looks something like this:

TRANS_CODES = ( 'SellCar', 'BuyCar', 'BuyFee', 'SellFee',
   'Gas/Fuel', 'Detail', 'Wash/Vac', 'Trans/Hauling',
   'Service/Repair', 'DraftFee', 'Misc', 'Cash',
   'CheckPaid', 'CheckRcvd', 'FloorPlan', 'Draft')

class Trans(Base):
    __tablename__ = 'trans'

    code = Column(Enum(*TRANS_CODES, name='trans_codes'),
           nullable=False)

When I attempt to save a 'Cash' transaction I get the error below on the enum value. Any suggestions on how to troubleshoot this?

Thanks,
Michael
---------------------------------------------------
sqlalchemy.exc.DataError: (DataError) invalid input value for enum trans_codes: "Cash"
LINE 1: ...1T15:55:32.943000'::timestamp, false, false, E'', E'Cash', E...
^
'INSERT INTO trans (date, void, printed, agent, code, ch_num, memo, payee, exp_id, qty, each, payment, deposit, invoice_id, account_id) VALUES (%(date)s, %(void)s, %(printed)s, %(agent)s, %(code)s, %(ch_num)s, %(memo)s, %(payee)s, %(exp_id)s, %(qty)s, %(each)s, %(payment)s, %(deposit)s, %(invoice_id)s, %(account_id)s) RETURNING trans.id_' {'code': 'Cash', 'account_id': None, 'invoice_id': 2, 'void': False, 'agent': '', 'qty': Decimal('1'), 'payee': '', 'deposit': False, 'payment': True, 'each': Decimal('1000.00'), 'date': datetime.datetime(2010, 10, 31, 15, 55, 32, 943000), 'exp_id': '', 'ch_num': '', 'memo': 'TEST AUTOMATIC PAYMENT', 'printed': False}

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

Reply via email to