@@ -69,7 +69,6 @@ def generate_insert_for_dictionary_list(table, next_id, value):
6969
7070@add_method (DictionaryProperty )
7171def generate_insert_information (self , dictionary_name , stix_object , ** kwargs ): # noqa: F811
72- bindings = dict ()
7372 data_sink = kwargs .get ("data_sink" )
7473 table_name = kwargs .get ("table_name" )
7574 schema_name = kwargs .get ("schema_name" )
@@ -103,23 +102,37 @@ def generate_insert_information(self, dictionary_name, stix_object, **kwargs):
103102 ]
104103 child_table_inserts = generate_insert_for_dictionary_list (table_child , next_id , value )
105104 value = next_id
105+ stix_type = IntegerProperty ()
106+ else :
107+ contained_type = valid_types [0 ].contained
108+ stix_type = ListProperty (contained_type )
109+ value = [data_sink .db_backend .process_value_for_insert (contained_type , x ) for x in value ]
106110 else :
107111 value_binding = "value"
112+ stix_type = StringProperty ()
108113 elif isinstance (value , int ) and is_valid_type (IntegerProperty , valid_types ):
109114 value_binding = "integer_value"
115+ stix_type = IntegerProperty ()
110116 elif isinstance (value , str ) and is_valid_type (StringProperty , valid_types ):
111117 value_binding = "string_value"
118+ stix_type = StringProperty ()
112119 elif isinstance (value , bool ) and is_valid_type (BooleanProperty , valid_types ):
113120 value_binding = "boolean_value"
121+ stix_type = BooleanProperty ()
114122 elif isinstance (value , float ) and is_valid_type (FloatProperty , valid_types ):
115123 value_binding = "float_value"
124+ stix_type = FloatProperty ()
116125 elif isinstance (value , STIXdatetime ) and is_valid_type (TimestampProperty , valid_types ):
117126 value_binding = "timestamp_value"
127+ stix_type = TimestampProperty ()
118128 else :
119129 value_binding = "string_value"
130+ stix_type = StringProperty ()
120131
121132 bindings ["name" ] = name
122- bindings [value_binding ] = value
133+ bindings [value_binding ] = data_sink .db_backend .process_value_for_insert (stix_type , value )
134+
135+
123136
124137 insert_statements .append (insert (table ).values (bindings ))
125138
@@ -285,11 +298,7 @@ def generate_insert_information( # noqa: F811
285298 return insert_statements
286299 else :
287300 if db_backend .array_allowed ():
288- if isinstance (self .contained , HexProperty ):
289- return {name : [data_sink .db_backend .process_value_for_insert (self .contained , x ) for x in stix_object [name ]]}
290- else :
291- return {name : stix_object [name ]}
292-
301+ return {name : [data_sink .db_backend .process_value_for_insert (self .contained , x ) for x in stix_object [name ]]}
293302 else :
294303 insert_statements = list ()
295304 table = data_sink .tables_dictionary [
0 commit comments