Skip to content
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

Spanner: Read multiple keys with index #4386

Conversation

chemelnucfin
Copy link
Contributor

reads multiple keys using index

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 13, 2017
@chemelnucfin chemelnucfin force-pushed the issue4364-read_index_with_single_key branch 3 times, most recently from 0d0299e to 177df9c Compare November 13, 2017 16:07
@dhermes dhermes added the api: spanner Issues related to the Spanner API. label Nov 13, 2017
@dhermes
Copy link
Contributor

dhermes commented Nov 13, 2017

@chemelnucfin Don't forget to add relevant labels to PRs as well as issues

def test_read_with_multiple_keys_index(self):
ROW_COUNT = 10
EXTRA_DDL = ['CREATE INDEX name ON contacts(first_name, last_name)']
MY_COLUMNS = self.COLUMNS[1], self.COLUMNS[2]

This comment was marked as spam.

pool = BurstyPool()

temp_db = Config.INSTANCE.database(
'test_read_multi_keys_index', ddl_statements=DDL_STATEMENTS + EXTRA_DDL,

This comment was marked as spam.

@chemelnucfin chemelnucfin changed the title read multiple keys with index Spanner: read multiple keys with index Nov 13, 2017
@chemelnucfin chemelnucfin force-pushed the issue4364-read_index_with_single_key branch from 177df9c to a9bd0cc Compare November 13, 2017 17:26
pool = BurstyPool()

temp_db = Config.INSTANCE.database(
'test_read_multi_keys_index', ddl_statements=DDL_STATEMENTS + EXTRA_DDL,

This comment was marked as spam.

This comment was marked as spam.

self.to_delete.append(session)
expected = list(
[[row[1], row[2]] for
index, row in enumerate(self._row_data(ROW_COUNT))])

This comment was marked as spam.

[[row[1], row[2]] for
index, row in enumerate(self._row_data(ROW_COUNT))])
keyset = [(expected[index][0], expected[index][1]) for
index in range(len(expected))]

This comment was marked as spam.

MY_COLUMNS,
KeySet(keys=keyset),
index='name'))
temp_db.drop()

This comment was marked as spam.

@tseaver
Copy link
Contributor

tseaver commented Nov 13, 2017

Ugh, @chemelnucfin my review comments predated your force push. They are still probably valid.

if not temp_db.exists(): # prevent Conflicts
operation = temp_db.create()
self.to_delete.append(_DatabaseDropper(temp_db))
operation.result(90)

This comment was marked as spam.

expected = list(
[[row[1], row[2]] for
index, row in enumerate(self._row_data(ROW_COUNT))]
)

This comment was marked as spam.

This comment was marked as spam.

keyset = [
(expected[index][0], expected[index][1]) for
index in range(len(expected))
]

This comment was marked as spam.

KeySet(keys=keyset),
index='name')
)
temp_db.drop()

This comment was marked as spam.

@chemelnucfin chemelnucfin force-pushed the issue4364-read_index_with_single_key branch from a9bd0cc to c1f7d3c Compare November 14, 2017 23:32
@chemelnucfin
Copy link
Contributor Author

@tseaver PTAL, thanks.

ddl_create = ['CREATE INDEX name ON contacts(first_name, last_name)']
columns = self.COLUMNS[1], self.COLUMNS[2]
try:
operation = self._db.update_ddl(ddl_create)

This comment was marked as spam.

This comment was marked as spam.

session, committed = self._set_up_table(row_count, db=self._db)
self.to_delete.append(session)
expected = [[row[1], row[2]] for row in self._row_data(row_count)]
keyset = [(row[0], row[1]) for row in expected]

This comment was marked as spam.

This comment was marked as spam.

@chemelnucfin chemelnucfin changed the title Spanner: read multiple keys with index Spanner: Read multiple keys with index Nov 18, 2017
@chemelnucfin chemelnucfin force-pushed the issue4364-read_index_with_single_key branch 4 times, most recently from 060e73d to 7b931ff Compare December 5, 2017 00:33
@chemelnucfin chemelnucfin force-pushed the issue4364-read_index_with_single_key branch from 7b931ff to 2ea8daa Compare December 5, 2017 00:33
@chemelnucfin
Copy link
Contributor Author

@tseaver PTAL, thanks.

@chemelnucfin chemelnucfin merged commit 3fb9f16 into googleapis:master Dec 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the Spanner API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants