python - Mapping non-ascii, long column names in SQLAlchemy fails with NoSuchColumnError -


Could it be that the key of the RowProxy object is shortened to some length?

I have a legacy. MSSQL database has some column names with letters with accented letters

I am mapping it with the following code for the Python property:

  @ event.listens_for (table, "column_reflect") def column_reflect (inspector, table, column_info): If table.name == 'D_Allomanylista_Komplex_V': # set column.key = "attr_ & LT; lower_case_name & gt;" Colm_to_chenj = { 'Olpot' "Elepot 'Bijhteniv' 'Bijhttoyo_ave, U'levlejh \ xe 9siC \ xedmUtca': 'Levelejhsi Simayutaka, U'sjerjh \ u0151d \ xe9sSorsz \ xe1m': 'Sjhejhods Sjham, Colm_info [ 'key'] = columns_to_change.get (column_info [ 'name'], column_info [ 'name']) komplex_table = inspect_komplex_table () class BiztositasokModel (base): __table__ = komplex_table __mapper_args__ = { 'primary_key': [ komplex_table.c [u 'KTVSZAM'], komplex_table.c [u'NyugtaSzam '], komplex_table.c [u'ajanlatszam'], komplex_table.c [ 'SzerzodesSzam'],], 'include_properties': [ 'biztosito_neve', Compleks_teblkk [ 'Allpot'], Compleks_teblkk [ 'Levelezesisimutka'], Compleks_teblkk [ 'Szerjodaeszm'], 'Ktvszm' Nugtszm 'Ajnltszm']}   < P> Unfortunately, this code gives an error saying that  SzerzodesSzam  column does not exist, when I try to query.  
  /Users/viktornagy/.virtualenvs/dosszie/lib/python2. _instance (line, result) 361 detection in the site-packages / sqlalchemy / orm / loading.pyc Identify Ykey = (362 identities-square, -> 363 tople ([row [column in pk_cols] column]) 364 ) 365 /Users/viktornagy/.virtualenvs/dosszie/lib/python2.7/site-packages/sqlalchemy/engine/result.pyc in _key_fallback (self, key, raiseerr) lifting 329 exc.NoSuchColumnError (330% "column"% S 'column' -> 331 expression._string_or_unprintable (key)) 332 left: 333 No return NoSuchColumnError: "D_Allomanylista_Komplex_V.Szerz \ 'u0151d in the row for column column could not be found" \\ xe9sSorsz \\ xe1m '"  

I get this issue He went into debugging mode to find out the root, and found that the top column on line 363 is column ('Szerz \ u0151d \ xe9sSorsz \ xe1m', integer (), table = & lt; D_Allomanylista_Komplex_V & gt; Key = 'SzerzodesSzam', null = false) while this is the line.key () is you_a_lammnist_complex_V signatures \ u0151d \ xe9sSorsz '. If the key has to be small ( u'Szerz \ u0151d \ xe9sSorsz ' one more and u'szerz \ u0151d \ xe9sSorsz \ xe1m' at another point) .

query line [u'D_Allomanylista_Komplex_V_Szerz \ u0151d \ xe9sSorsz '] actually works, and gives expected results.

Is there a way to avoid it?

The above pyodbc driver has a limit. Problem solved by switching to pymssql

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -