Skip to content

fix: issue 117 ssl config #121

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 12 commits into from
Mar 5, 2025
Merged

fix: issue 117 ssl config #121

merged 12 commits into from
Mar 5, 2025

Conversation

karel-rehor
Copy link
Contributor

@karel-rehor karel-rehor commented Feb 26, 2025

Closes #117

Proposed Changes

  1. Introduce QueryApiOptions and QueryApiOptionsBuilder
  2. In these options include fields for tls_root_certs and tls_verify which map to Arrow FlightClientOptions tls_root_certs and disable_server_verification respectively. N.B. logic of disable_server_verification is the opposite of tls_verify
  3. Use these options classes when constructing a new QueryApi
  4. Use all these new features when creating _query_api in the InfluxDBClient3 constructor.

see also (https://arrow.apache.org/docs/cpp/api/flight.html#_CPPv4N5arrow6flight19FlightClientOptionsE)

Checklist

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

@karel-rehor karel-rehor changed the title Fix/117 ssl config fix: issue 117 ssl config Feb 26, 2025
@karel-rehor
Copy link
Contributor Author

Tested this by hand against Honza's clustered deployment. I get expected results, including failures with a bad .pem file. Further tests to be tried tomorrow.

def test_all():
    print("\ninfluxdb3 version: " + VERSION)
    client = InfluxDBClient3(host=host,
                             database=database,
                             org=org,
                             token=token,
                             auth_scheme="Bearer",
                             debug=True,
                             verify_ssl=True,
                             #flight_client_options={'cert_chain':'/home/karl/bonitoo/qa/temp/influxdb3-python-issue117/foo.pem'},
                             #flight_client_options={'cert_chain':'/home/karl/.local/lib/python3.12/site-packages/certifi/cacert.pem'},
                             #ssl_ca_cert="/home/karl/bonitoo/qa/temp/influxdb3-python-issue117/cert.pem")
                             ssl_ca_cert="/etc/ssl/certs/ca-certificates.crt")

    now = int(round(time.time()))

    # result = client.write("scooter,location=folimanka speed=31 %s" % now,
    #                       write_precision=WritePrecision.S)
    # print(f"DEBUG result {result}\n")
    query = "SELECT * FROM scooter"
    table = client.query(query)
    print(f"DEBUG qresult\n {table.to_pandas()}")

Copy link

codecov bot commented Feb 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.63%. Comparing base (19c1c25) to head (d6ae2ba).
Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #121      +/-   ##
==========================================
+ Coverage   60.45%   61.63%   +1.17%     
==========================================
  Files          33       33              
  Lines        2051     2101      +50     
==========================================
+ Hits         1240     1295      +55     
+ Misses        811      806       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@karel-rehor karel-rehor marked this pull request as ready for review March 3, 2025 13:59
Copy link

@jansimonb jansimonb left a comment

Choose a reason for hiding this comment

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

LGTM, thanks 👍

@karel-rehor karel-rehor merged commit 95477f8 into main Mar 5, 2025
15 checks passed
@karel-rehor karel-rehor deleted the fix/117-ssl-config branch March 5, 2025 12:31
@karel-rehor karel-rehor added this to the 0.12.0 milestone Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants