Skip to content

Conversation

@jpinner-lyft
Copy link
Contributor

@jpinner-lyft jpinner-lyft commented Nov 10, 2017

No description provided.

@jpinner-lyft jpinner-lyft added this to the 3.3.0 milestone Nov 10, 2017
last_evaluated_key[key] = item[key]
else:
# Use the table meta data to determine the key attributes
table_connection = self.page_iter._operation.im_self
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we write a private method to expose this? do we need this other places in the file?

else:
# Use the table meta data to determine the key attributes
table_connection = self.page_iter._operation.im_self
table_meta = table_connection.connection.get_meta_table(table_connection.table_name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@jpinner-lyft jpinner-lyft force-pushed the fix-last-evaluated-key branch from 18b2f71 to ac35cb5 Compare November 10, 2017 01:00
Returns the names of the primary key attributes and index key attributes (if index_name is specified)
"""
key_names = [self.hash_keyname]
range_keyname = self.range_keyname
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if self.range_keyname:
    key_names.append(self.range_keyname)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would require us to search for it twice if it doesn't exist

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

search? twice? it's only used once in this method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.range_keyname is a property computed by scanning the metadata -- its memoized, but only if the value is not None -- if it is None, the if statement will search and then ....

actually you're right, if it's None you won't enter the if block -- updating

range_keyname = self.range_keyname
if range_keyname is not None:
key_names.append(range_keyname)
if index_name is not None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there not more than one index?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to get the keys on a per-index basis since they are different for each index

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think that's what i'm asking... shouldn't there be a loop here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the function (as written) returns keys for a specific index (or for the table if no index is specified), not all combinations for all indexes

@jpinner-lyft jpinner-lyft force-pushed the fix-last-evaluated-key branch 2 times, most recently from 95ed732 to f1450e5 Compare November 10, 2017 01:09
@jpinner-lyft jpinner-lyft force-pushed the fix-last-evaluated-key branch from f1450e5 to 11f84ef Compare November 10, 2017 01:22
break
return self._hash_keyname

def get_key_names(self, index_name=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add some tests for this

@jpinner-lyft jpinner-lyft merged commit 01d0b59 into master Nov 10, 2017
@jpinner-lyft jpinner-lyft deleted the fix-last-evaluated-key branch November 10, 2017 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants