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

feat: query bind parameters #220

Merged
merged 5 commits into from
Apr 7, 2021
Merged

feat: query bind parameters #220

merged 5 commits into from
Apr 7, 2021

Conversation

rhajek
Copy link
Contributor

@rhajek rhajek commented Apr 1, 2021

Closes #219

Example of usage:

p = {"_start": datetime.timedelta(hours=-1),
     "_location": "Prague",
     "_desc": True,
     "_floatParam": 25.1,
     "_every": datetime.timedelta(minutes=5)
     }

tables = query_api.query('''
    from(bucket:"my-bucket") |> range(start: _start)
        |> filter(fn: (r) => r["_measurement"] == "my_measurement")
        |> filter(fn: (r) => r["_field"] == "temperature")
        |> filter(fn: (r) => r["location"] == _location and r["_value"] > _floatParam)
        |> aggregateWindow(every: _every, fn: mean, createEmpty: true)        
        |> sort(columns: ["_time"], desc: _desc) 
''', params=p)

Checklist

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

@codecov
Copy link

codecov bot commented Apr 1, 2021

Codecov Report

Merging #220 (a9d5adf) into master (8df7b18) will increase coverage by 0.11%.
The diff coverage is 98.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #220      +/-   ##
==========================================
+ Coverage   90.53%   90.64%   +0.11%     
==========================================
  Files          26       26              
  Lines        1975     2010      +35     
==========================================
+ Hits         1788     1822      +34     
- Misses        187      188       +1     
Impacted Files Coverage Δ
influxdb_client/client/query_api.py 97.72% <97.87%> (-0.49%) ⬇️
influxdb_client/client/util/date_utils.py 96.00% <100.00%> (+1.26%) ⬆️
influxdb_client/client/write/point.py 98.36% <100.00%> (-0.04%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8df7b18...a9d5adf. Read the comment docs.

@rhajek rhajek changed the title Feat/bind parameters feat: query bind parameters Apr 1, 2021
@bednar bednar self-requested a review April 6, 2021 05:59
@bednar bednar merged commit 2870071 into master Apr 7, 2021
@bednar bednar deleted the feat/bind_parameters branch April 7, 2021 05:27
@bednar bednar added this to the 1.17.0 milestone Apr 7, 2021
rhajek added a commit that referenced this pull request Apr 13, 2021
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.

Bind query parameters
2 participants