Hello
we try to ingest data from SQL SERVER into Snowflake
therefor we are using the JDBC incremental compoenent.
We though we can script the TABLES; COLUMNS;IS_INCREMENT,IS_KEY
- so first step is defining all the tables we want to ingest => define in a grid variabel (ok)
- reading all column meta data for all tables from source database (sql server) (ok)
- having a pyhton script which generates a grid variable with the table, column, is_increment, is_key which would be used in the "jdbc incremental component" (update the grid variable is causing some trouble)
here is the script
``py_my_grid_variable = context.getGridVariable('gv_tables_cols')
print(py_my_grid_variable)
# Only do the rest if the grid variable is not empty, and contains more than 0 values.
# Otherwise the default, empty value of py_my_scalar_variable will persist
gv = []
py_my_scalar_variable = ''
if py_my_grid_variable is not None:
if len(py_my_grid_variable) > 0 :
## Matillion grid variables are lists of lists.
for x in py_my_grid_variable :
g = []
if x[0] == jv_column_isincrement :
is_increment=1
is_key=0
else :
is_increment=0
is_key=0
g.append(jv_table)
col = str(x[0])
g.append(col)
g.append(is_increment)
g.append(is_key)
gv.append(g)
a= context.updateGridVariable('gv_metadata', gv)
print(len(gv))
print (context.getGridVariable('gv_metadata'))
``
the problem is that
a= context.updateGridVariable('gv_metadata', gv)
print (context.getGridVariable('gv_metadata'))
it is updating the gridvariable a kind of but is failing for some reason
when we print out the grid variable gv_metadata than there is some null after the array
which is strange , because when we print the array of list gv than it looks fine
Does anyone have some ideas why the context.getGridVariable('gv_metadata')) is not properly working?
Thx Martin