-
Notifications
You must be signed in to change notification settings - Fork 35
adds ability to set field types explicitly #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bulk_insert.py
Outdated
| return struct.pack(format_str, Type.STRING, encoded_str) | ||
|
|
||
| ## if it hasn't returned by this point, it is trying to set it to a type that it can't adopt | ||
| raise Exception("unable to parse [" + prop_str + "] with type ["+type+"]") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to print type as repr(type) or similar, as non-string values will raise a TypeError here.
jeffreylovitz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great addition! I have two minor requests.
bulk_insert.py
Outdated
| QUOTING=csv.QUOTE_NONE | ||
| try : | ||
| FIELD_TYPES = json.loads(field_types) | ||
| except: FIELD_TYPES = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that failure to parse field_types should cause a printed warning or an exception (no strong preference between the two).
jeffreylovitz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much, @renewooller ! This is a fantastic addition.
No description provided.