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

Upsert #1287

Merged
merged 44 commits into from
Jul 19, 2023
Merged

Upsert #1287

merged 44 commits into from
Jul 19, 2023

Conversation

doctrino
Copy link
Contributor

@doctrino doctrino commented Jul 13, 2023

Description

Done ready for full review.

Found a issue with Sequence.columns added an issue on it here; #1292

But saving that implementation for later.

Checklist:

  • Tests added/updated.
  • Documentation updated. Documentation is generated from docstrings - these must be updated according to your change.
    If a new method has been added it should be referenced in cognite.rst in order to generate docs based on its docstring.
  • Changelog updated in CHANGELOG.md.
  • Version bumped. If triggering a new release is desired, bump the version number in _version.py and pyproject.toml per semantic versioning.

@codecov
Copy link

codecov bot commented Jul 13, 2023

Codecov Report

Merging #1287 (0ca71d1) into master (345f622) will decrease coverage by 0.06%.
The diff coverage is 86.78%.

❗ Current head 0ca71d1 differs from pull request most recent head d5fe468. Consider uploading reports for the commit d5fe468 to get more accurate results

@@            Coverage Diff             @@
##           master    #1287      +/-   ##
==========================================
- Coverage   90.75%   90.69%   -0.06%     
==========================================
  Files         104      104              
  Lines       12120    12269     +149     
==========================================
+ Hits        10999    11127     +128     
- Misses       1121     1142      +21     
Impacted Files Coverage Δ
cognite/client/_api/assets.py 94.92% <77.77%> (-0.60%) ⬇️
cognite/client/_api/events.py 90.16% <77.77%> (-2.29%) ⬇️
cognite/client/_api/relationships.py 95.77% <77.77%> (-2.64%) ⬇️
cognite/client/_api/time_series.py 90.16% <77.77%> (-2.29%) ⬇️
cognite/client/_api/sequences.py 94.31% <78.57%> (-1.44%) ⬇️
cognite/client/_api_client.py 91.91% <80.64%> (-1.68%) ⬇️
cognite/client/_api/annotations.py 88.88% <100.00%> (ø)
cognite/client/_version.py 100.00% <100.00%> (ø)
cognite/client/data_classes/_base.py 94.35% <100.00%> (+0.13%) ⬆️
cognite/client/data_classes/annotations.py 96.66% <100.00%> (+0.11%) ⬆️
... and 13 more

... and 2 files with indirect coverage changes

@doctrino doctrino marked this pull request as ready for review July 16, 2023 10:21
@doctrino doctrino requested review from a team as code owners July 16, 2023 10:21
cognite/client/_api_client.py Outdated Show resolved Hide resolved
cognite/client/_api/events.py Outdated Show resolved Hide resolved
tests/tests_integration/test_api/test_events.py Outdated Show resolved Hide resolved
tests/tests_integration/test_api/test_events.py Outdated Show resolved Hide resolved
Copy link
Contributor

@haakonvt haakonvt 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 good stuff, yo

cognite/client/_api/events.py Outdated Show resolved Hide resolved
cognite/client/_api_client.py Outdated Show resolved Hide resolved
cognite/client/_api/assets.py Outdated Show resolved Hide resolved
cognite/client/_api/files.py Outdated Show resolved Hide resolved
cognite/client/_api/time_series.py Outdated Show resolved Hide resolved
cognite/client/_api_client.py Outdated Show resolved Hide resolved
PropertySpec("name", is_nullable=False),
PropertySpec("description"),
PropertySpec("data_set_id"),
PropertySpec("metadata", is_list=True),
Copy link
Contributor

Choose a reason for hiding this comment

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

The is_list name feels odd. What about is_object or is_container?

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 think is_object is misleading. Not a strong preference, although I lean towards staying is_list. @erlendvollset Thought?

Copy link
Collaborator

Choose a reason for hiding this comment

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

is_list sounds wrong for objects yes. how about just is_primitive?

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 think is_primitive would be the opposite of is_list? In that case I will go with is_container

cognite/client/data_classes/_base.py Outdated Show resolved Hide resolved
cognite/client/data_classes/files.py Outdated Show resolved Hide resolved
tests/tests_integration/test_api/test_events.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@erlendvollset erlendvollset left a comment

Choose a reason for hiding this comment

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

Let's add a section to the docs describing the patch vs. replace behaviour.

cognite/client/data_classes/_base.py Outdated Show resolved Hide resolved
PropertySpec("name", is_nullable=False),
PropertySpec("description"),
PropertySpec("data_set_id"),
PropertySpec("metadata", is_list=True),
Copy link
Collaborator

Choose a reason for hiding this comment

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

is_list sounds wrong for objects yes. how about just is_primitive?

cognite/client/data_classes/assets.py Show resolved Hide resolved
cognite/client/_api_client.py Outdated Show resolved Hide resolved
cognite/client/_api_client.py Outdated Show resolved Hide resolved
@erlendvollset
Copy link
Collaborator

We should also make it very explicit that this upsert operation is not atomic.

@doctrino doctrino requested a review from erlendvollset July 19, 2023 14:40
Copy link
Collaborator

@erlendvollset erlendvollset left a comment

Choose a reason for hiding this comment

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

LGTM!

@doctrino doctrino merged commit cdb8f88 into master Jul 19, 2023
@doctrino doctrino deleted the core-upsert branch July 19, 2023 15:15
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