Skip to content

Commit f4e6e56

Browse files
renewoollerjeffreylovitz
authored andcommitted
Fix property offsets in user-provided JSON field types (#11)
* allows any csv quote format * updates bulk loader to be able to set types explicitly * updates documentation and help * set default field types to none * adds exception when field types is malformed * puts type in repr * updates readme * fixes bug with field-types indices not being correctly referenced
1 parent a83eee5 commit f4e6e56

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bulk_insert.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,13 @@ def pack_header(self, header):
159159
def pack_props(self, line):
160160
props = []
161161
for num, field in enumerate(line[self.prop_offset:]):
162+
field_type_idx = self.prop_offset+num
162163
try :
163164
FIELD_TYPES[self.entity_str][num]
164165
except :
165166
props.append(prop_to_binary(field, None))
166167
else :
167-
props.append(prop_to_binary(field, FIELD_TYPES[self.entity_str][num]))
168-
168+
props.append(prop_to_binary(field, FIELD_TYPES[self.entity_str][field_type_idx]))
169169
return b''.join(p for p in props)
170170

171171
def to_binary(self):

0 commit comments

Comments
 (0)