python - Accented column names, introspection and mapping -


I want to use a legacy MSSQL database using SQLAlchemy. With the basic schema inspection I can already list the columns of tables in which I am interested. Unfortunately, the names of these columns are sometimes desired characters (such as "Magajhijhemai Livy", "Levelejhesisisiaiaiaraaaasisamajh"). / P>

My only requirement is to be able to query this DB.

I've listed some of the database name for you by using the following command

  def inspect_komplex_table (): Table = Table ( 'D_Allomanylista_Komplex_V', Meta, autoload = True, Autoload_with = engine) return table def get_columns (): keys = inspect_komplex_table (). Columns.keys () keys.sort () returns txt = '\ n' type (txt.encode ( 'utf8'))   

A (long it column_names) list ( ' Column_names.txt ',' w '). .txt file with lines:

  ... JUTE? RVKZad KZET KTTSAMAM PKLAB of Kamratigzam ?? K Lejhrlet Levelejhesi Siaimaiaraaiaa Tissaajiam Levelejhes C. Utka Levelejia Sisiamvioaros ...   

I have tried to make an original mapping before without the columns

  class BiztositasokModel (object): def __init __ (self, UgyfKod): self.ugyfelkod = UgyfKod   

where UgyfKod is an introspection of the column, but

  Mapper (Bjattasoc Model, Inspect_Comlex_Table ())   

U Nickode encoded error

Can someone give me an idea to handle such a DB? While

I have managed to find the answer, using a declarative syntax, second, classical mapping using the.

Apply a method to change the mapping column default naming scheme to Python object properties.

The answer to classical mapping is:

Answer: Using a declarative syntax:

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 -