Added config folder with TSV columns for each model

This commit is contained in:
DiG 2022-02-05 21:32:27 +01:00
parent a4473cc7d0
commit ad7949805d
2 changed files with 8 additions and 2 deletions

View File

@ -1 +1 @@
id name category
id name category_id.name
1 id name category category_id.name

View File

@ -37,6 +37,12 @@ def csv( *fields ):
def json( obj ):
print( JSON.dumps(obj, indent=4) ) #"\t") )
def get_at_path( obj, prop ):
path = prop.split('.')
cur = obj
for key in path:
cur = cur[key]
return cur
def render_tsv( model, list ):
@ -48,7 +54,7 @@ def render_tsv( model, list ):
tsv( *_cols )
for obj in list:
tsv( *[ obj[col] for col in _cols] )
tsv( *[ get_at_path(obj,col) for col in _cols] )
def render_csv( model, list ):