55
55
'inet' : '0'
56
56
57
57
}
58
+ system_keyspace = ['OpsCenter' ,'dse_insights_local' ,'solr_admin' ,'test' ,'dse_system' ,'dse_analytics' ,'system_auth' ,'system_traces' ,'system' ,'dse_system_local' ,'system_distributed' ,'system_schema' ,'dse_perf' ,'dse_insights' ,'dse_security' ,'dse_system' ,'killrvideo' ,'dse_leases' ,'dsefs_c4z' ,'HiveMetaStore' ,'dse_analytics' ,'dsefs' ,'spark_system' ]
59
+ tp_tbl_data = {
60
+ 'Materialized Views' :{},
61
+ 'Secondary Indexes' :{},
62
+ 'Storage-Attached Indexes' :{}
63
+ }
58
64
59
65
def field_type_comment (tbl ,fieldName ,fieldType ):
60
66
if fieldType == 'date' :
@@ -99,6 +105,18 @@ def field_type_comment(tbl,fieldName,fieldType):
99
105
cfg_array = {}
100
106
schema_name = 'schema'
101
107
108
+ def add_tp_tbl (gr ,ks ,tbl ,src_ks ,src_tbl ):
109
+ if src_ks not in system_keyspace :
110
+ try :
111
+ type (tp_tbl_data [gr ][src_ks ])
112
+ except :
113
+ tp_tbl_data [gr ][src_ks ]= {}
114
+ try :
115
+ type (tp_tbl_data [gr ][src_ks ][src_tbl ])
116
+ except :
117
+ tp_tbl_data [gr ][src_ks ][src_tbl ] = []
118
+ if (ks + '.' + tbl ) not in tp_tbl_data [gr ][src_ks ][src_tbl ]:
119
+ tp_tbl_data [gr ][src_ks ][src_tbl ].append (ks + '.' + tbl )
102
120
103
121
def process_field (tbl ,fieldName ,fieldType ,cql = '' ):
104
122
if 'map<' in fieldType :
@@ -113,6 +131,12 @@ def process_field(tbl,fieldName,fieldType,cql=''):
113
131
for mapType in mapData :
114
132
fieldValue += '%' + field_type_array [mapType .strip ()]
115
133
field_type_comment (tbl ,fieldName ,mapType .strip ())
134
+ elif 'list<' in fieldType :
135
+ mapData = fieldType .split ('<' )[1 ].split ('>' )[0 ].split (',' )
136
+ fieldValue = field_type_array ['list' ]
137
+ for mapType in mapData :
138
+ fieldValue += '%' + field_type_array [mapType .strip ()]
139
+ field_type_comment (tbl ,fieldName ,mapType .strip ())
116
140
elif fieldType in field_types :
117
141
fieldValue = field_type_array [fieldType ]
118
142
else :
0 commit comments