@@ -676,6 +676,7 @@ def validate_entity(namespace):
676676 """ Converts a list of key value pairs into a dictionary. Ensures that required
677677 RowKey and PartitionKey are converted to the correct case and included. """
678678 values = dict (x .split ('=' , 1 ) for x in namespace .entity )
679+ edm_types = {}
679680 keys = values .keys ()
680681 for key in list (keys ):
681682 if key .lower () == 'rowkey' :
@@ -686,6 +687,12 @@ def validate_entity(namespace):
686687 val = values [key ]
687688 del values [key ]
688689 values ['PartitionKey' ] = val
690+ elif key .endswith ('@odata.type' ):
691+ val = values [key ]
692+ del values [key ]
693+ real_key = key [0 : key .index ('@odata.type' )]
694+ edm_types [real_key ] = val
695+
689696 keys = values .keys ()
690697 missing_keys = 'RowKey ' if 'RowKey' not in keys else ''
691698 missing_keys = '{}PartitionKey' .format (missing_keys ) \
@@ -708,8 +715,12 @@ def try_cast(to_type):
708715
709716 return try_cast (int ) or try_cast (float ) or val
710717
711- # ensure numbers are converted from strings so querying will work correctly
712- values = {key : cast_val (key , val ) for key , val in values .items ()}
718+ for key , val in values .items ():
719+ if edm_types .get (key , None ):
720+ values [key ] = (val , edm_types [key ])
721+ else :
722+ # ensure numbers are converted from strings so querying will work correctly
723+ values [key ] = cast_val (key , val )
713724 namespace .entity = values
714725
715726
0 commit comments