Как создать функцию/модуль сопоставления столбцов источника и назначения в Python?
Problem : I have a source schema (a bunch of tables) and a destination schema (a fixed number of tables with predefined columns) in postgres. I want to design a mapper-insert function which would map the source column(s) to a particular column of a table in destination schema.
What I have tried:
Idea : I thought of constructing a JSON file which will be of {Destination_column : Source_column(s)} kind of construct. In case of multiple source column I thought of passing the as list in the value of dictionary. After that I plan to create a mapper function to define the operations on the source column and insert function to insert the value after performing the operation.
Question : Is this the correct pythonic way to solve this problem? Do we have any python libraries (petl or bonobo) which does source-destination mapping? Thoughts?