dont send tuples as bind parameters for scalar attributes. one or more members of your "data" dictionary are tuples.
On Sep 30, 2010, at 6:12 PM, phasma wrote: > If add to sqlalchemy/orm/mapper.py at 1699 line this code: > > if isinstance(value, tuple): > value = value[0] > > Insert works correctly. > > On Sep 30, 9:31 pm, phasma <xpa...@gmail.com> wrote: >> Hi. >> >> I've got autoloadable table: >> >> --------------------------------------------------------------------------- >> ---- >> >> class ObjectList(object): >> pass >> >> .... >> >> t_object_list = sa.Table('object_list', meta.metadata, autoload=True, >> autoload_with=engine) >> orm.mapper(ObjectList, t_object_list) >> >> --------------------------------------------------------------------------- >> ----- >> >> And when I'm trying insert data: >> >> --------------------------------------------------------------------------- >> ----- >> >> ol = ObjectList() >> ol.type = data['type'], >> ol.name = data['name'], >> ol.address = data['address'], >> ol.gps_lat = data['gps_lat'], >> ol.gps_lng = data['gps_lng'], >> ol._class = data['class'], >> ol.has_parking = data['has_parking'], >> ol.has_canteen = data['has_canteen'], >> ol.has_cafe = data['has_cafe'], >> ol.has_restaurant = data['has_restaurant'], >> ol.has_fitness = data['has_fitness'], >> ol.has_beauty_salon = data['has_beauty_salon'], >> ol.has_tire_shop = data['has_tire_shop'], >> ol.has_car_washer = data['has_car_washer'], >> ol.has_bank = data['has_bank'], >> ol.has_minibank = data['has_minibank'], >> ol.has_payment_terminal = data['has_payment_terminal'], >> ol.has_another = data['has_another'] >> >> meta.Session.add(ol) >> meta.Session.commit() >> >> -------------------------------------------------------------------- >> >> I've got error: >> >> ProgrammingError: (ProgrammingError) (1064, 'You have an error in your >> SQL syntax; check the manual that corresponds to your MySQL server >> version for the right syntax to use near \'), ("\'1\'",), ("\'1\'",), >> ("\'1\'",), ("\'1\'",), ("\'A\'",), (\'0\',), (\'0\',), (\'0\',), >> (\'0\' at line 1') 'INSERT INTO object_list (type, name, address, >> gps_lat, gps_lng, _class, has_parking, has_canteen, has_cafe, >> has_restaurant, has_fitness, has_beauty_salon, has_tire_shop, >> has_car_washer, has_bank, has_minibank, has_payment_terminal, >> has_another) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, >> %s, %s, %s, %s, %s, %s)' (('office',), ('1',)) ... and a total of 18 >> bound parameter sets >> >> Where is problems ? > > -- > 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. > -- 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.