I want to get python schema definition for table passed to get_schema method on runtime .
`
class Test:
def __init__(self):
self.schema_table1 = {
"name": "str",
"add": "str"
}
self.schema_table2 = {
"n1": "str",
"n2": "str"
}
def get_schema(self, table_name):
schema = table_name
return schema
class Test2:
def __init__(self):
self.test_obj = Test()
def process(self):
table_name = "schema_"+'table1'
print(self.test_obj.get_schema(table_name))
test2_obj = Test2()
test2_obj.process()
Actual output
schema_table1
**Expected output **
{
“name”: “str”,
“add”: “str”
}
New contributor
bamitabh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.