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

versioned_transact_write_items now supports lazy loading of items read #10

Conversation

petergaultney
Copy link
Contributor

and optimistic creation/deletion of items without a prefetch

@petergaultney petergaultney force-pushed the feature/allow-optimistic-writes-and-lazy-loaded-reads-in-transactions branch from 3714de6 to 537d944 Compare January 21, 2021 04:30
…d, and optimistic creation/deletion of items without a prefetch
@petergaultney petergaultney force-pushed the feature/allow-optimistic-writes-and-lazy-loaded-reads-in-transactions branch from 537d944 to 8071ac1 Compare January 21, 2021 15:41
Copy link
Contributor

@jwsloan jwsloan left a comment

Choose a reason for hiding this comment

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

This is a nice enhancement!


res = versioned_transact_write_items(opt_delete, dict())

assert None is get(res, integration_test_id_table.name, dict(id=test_id_to_delete))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why None is instead of is None?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i tend to think that putting the "what" on the left side and the "how" on the right makes things more readable.

this follows the general pattern of most languages and their code.

i'm just not all that consistent about it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting. The general pattern I thing I've seen is more actual on the left and expected on the right.

Copy link
Contributor Author

@petergaultney petergaultney Jan 22, 2021

Choose a reason for hiding this comment

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

i've seen that too, i'm just not sure it makes as much sense. it doesn't fit with the way we use programming languages in general.

there's a big exception to my approach that you may have encountered before:

expected = dict(foo='bar')
assert expected = do_the_actual(...)

I would not advocate putting variable names on the left, because you're risking accidentally assigning and thinking that your test passes when it doesn't.

but if you're writing small tests (which i often don't do), there's likely no need for the intermediate variable, and you could just as safely write

assert dict(foo='bar') == do_the_actual(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in the end, as long as it's not ambiguous what you're testing, i'm not going to complain if you do it the other way.

xoto3/dynamodb/README.md Outdated Show resolved Hide resolved
xoto3/dynamodb/write_versioned/errors.py Outdated Show resolved Hide resolved
@jwsloan
Copy link
Contributor

jwsloan commented Jan 22, 2021

@petergaultney when do you think you'll be able to get this merged and published?

@petergaultney petergaultney merged commit ba4ef19 into master Jan 22, 2021
@petergaultney petergaultney deleted the feature/allow-optimistic-writes-and-lazy-loaded-reads-in-transactions branch January 22, 2021 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants