Skip to content

feat: add Explicit bucket schemas API #528

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

Merged
merged 15 commits into from
Nov 10, 2022
Merged

Conversation

bednar
Copy link
Contributor

@bednar bednar commented Nov 3, 2022

Closes #525

Proposed Changes

  1. Added possibility to use Explicit bucket schemas API
  2. Added warning if the user uses Cloud only API - BucketSchemas, InvokableScripts. The following code:
    from influxdb_client import InfluxDBClient, BucketSchemasService
    
    with InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org") as client:
        bucket_schemas_api = BucketSchemasService(api_client=client.api_client)
    causes:
    The 'BucketSchemasService' is available only on the InfluxDB Cloud.
    
    For more info see:
        - https://docs.influxdata.com/influxdb/cloud/organizations/buckets/bucket-schema/
        - https://docs.influxdata.com/influxdb/cloud/
    
    You can disable this warning by:
        import warnings
        from influxdb_client.client.warnings import CloudOnlyWarning
    
        warnings.simplefilter("ignore", CloudOnlyWarning)
  3. Addad an example: How to manage explicit bucket schemas to enforce column names, tags, fields, and data types for your data

Checklist

  • CHANGELOG.md updated
  • Rebased/mergeable
  • A test has been added if appropriate
  • pytest tests completes successfully
  • Commit messages are conventional
  • Sign CLA (if not already signed)

@bednar bednar self-assigned this Nov 3, 2022
@codecov-commenter
Copy link

codecov-commenter commented Nov 4, 2022

Codecov Report

Base: 90.21% // Head: 90.25% // Increases project coverage by +0.04% 🎉

Coverage data is based on head (c963e76) compared to base (0927944).
Patch coverage: 100.00% of modified lines in pull request are covered.

❗ Current head c963e76 differs from pull request most recent head 193a459. Consider uploading reports for the commit 193a459 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #528      +/-   ##
==========================================
+ Coverage   90.21%   90.25%   +0.04%     
==========================================
  Files          39       39              
  Lines        3412     3427      +15     
==========================================
+ Hits         3078     3093      +15     
  Misses        334      334              
Impacted Files Coverage Δ
influxdb_client/__init__.py 100.00% <100.00%> (ø)
influxdb_client/client/__init__.py 100.00% <100.00%> (ø)
influxdb_client/client/warnings.py 100.00% <100.00%> (ø)
influxdb_client/client/write/__init__.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@bednar bednar marked this pull request as ready for review November 4, 2022 16:29
@bednar bednar requested a review from powersj November 4, 2022 16:29

warnings.simplefilter("ignore", CloudOnlyWarning)
"""
warnings.warn(message, CloudOnlyWarning)
Copy link
Contributor

Choose a reason for hiding this comment

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

This means users who are using this with cloud suddenly will get additional text for every usage correct? That seems less than ideal to make a user who is using this correctly to need to ignore a warning.

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 are right, I will add a checking to the type of instance before warning.

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 implementation of warning is changed. The warnings are displayed on individual actions and only if the InfluxD instance is not Cloud. For more info see:

@bednar bednar requested a review from powersj November 8, 2022 20:05
Copy link
Contributor

@powersj powersj left a comment

Choose a reason for hiding this comment

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

Thank you for fixing up the warning. I haven't gone through all the API generated code, only the logic and warnings changes that were added.

@bednar
Copy link
Contributor Author

bednar commented Nov 10, 2022

@powersj thanks for review. The generated code mainly contains only initialization of the base class.

@bednar bednar merged commit f3346d9 into master Nov 10, 2022
@bednar bednar deleted the explicit_bucket_schemas branch November 10, 2022 07:31
@bednar bednar added this to the 1.35.0 milestone Nov 10, 2022
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.

Support Cloud contract too
3 participants