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

Can this be used with local installation of influx db #16

Open
arunjose696 opened this issue Mar 18, 2023 · 3 comments
Open

Can this be used with local installation of influx db #16

arunjose696 opened this issue Mar 18, 2023 · 3 comments

Comments

@arunjose696
Copy link

arunjose696 commented Mar 18, 2023

Can FlightSQLClient be used with local installation of influx-db ,

query_client = FlightSQLClient(
    host = "localhost",
    token = token,
   port=8086,
    metadata={"bucket-name": bucket_name})
query = """SELECT *
        FROM table
        """
info = query_client.execute(query)

I got this error when trying to do this

File "<stdin>", line 1, in <module>
 File "C:\Users\arunj\anaconda3\envs\newenv\lib\site-packages\flightsql\client.py", line 123, in execute
   return self._get_flight_info(flightsql.CommandStatementQuery(query=query), call_options)
 File "C:\Users\arunj\anaconda3\envs\newenv\lib\site-packages\flightsql\util.py", line 8, in g
   return f(self, *args, **kwargs)
 File "C:\Users\arunj\anaconda3\envs\newenv\lib\site-packages\flightsql\client.py", line 293, in _get_flight_info
   return self.client.get_flight_info(flight_descriptor(command), options)

 File "pyarrow\_flight.pyx", line 1506, in pyarrow._flight.FlightClient.get_flight_info
 File "pyarrow\_flight.pyx", line 71, in pyarrow._flight.check_flight_status
pyarrow._flight.FlightUnavailableError: Flight returned unavailable error, with message: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8086: Ssl handshake failed: SSL_ERROR_SSL: error:0A00010B:SSL routines::wrong version number
@nightscape
Copy link

nightscape commented Apr 7, 2023

I'm also just trying to run this with a local IOx installation. It looks like the SSL verification can be turned off using the insecure parameter:

from flightsql import connect, FlightSQLClient

client = FlightSQLClient(host='localhost', port=8083, insecure=True)
conn = connect(client)
cursor = conn.cursor()
cursor.execute('select * from runs limit 10')
print("columns:", cursor.description)
print("rows:", [r for r in cursor])

I'm now getting a new error:

cursor.execute('select * from runs limit 10')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/martin/Library/Caches/pypoetry/virtualenvs/superset-Ovos_ljV-py3.11/lib/python3.11/site-packages/flightsql/util.py", line 8, in g
    return f(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/martin/Library/Caches/pypoetry/virtualenvs/superset-Ovos_ljV-py3.11/lib/python3.11/site-packages/flightsql/dbapi.py", line 54, in execute
    info = self.client.execute(query)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/martin/Library/Caches/pypoetry/virtualenvs/superset-Ovos_ljV-py3.11/lib/python3.11/site-packages/flightsql/client.py", line 123, in execute
    return self._get_flight_info(flightsql.CommandStatementQuery(query=query), call_options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/martin/Library/Caches/pypoetry/virtualenvs/superset-Ovos_ljV-py3.11/lib/python3.11/site-packages/flightsql/util.py", line 8, in g
    return f(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/martin/Library/Caches/pypoetry/virtualenvs/superset-Ovos_ljV-py3.11/lib/python3.11/site-packages/flightsql/client.py", line 293, in _get_flight_info
    return self.client.get_flight_info(flight_descriptor(command), options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pyarrow/_flight.pyx", line 1506, in pyarrow._flight.FlightClient.get_flight_info
  File "pyarrow/_flight.pyx", line 81, in pyarrow._flight.check_flight_status
  File "pyarrow/error.pxi", line 121, in pyarrow.lib.check_status
pyarrow.lib.ArrowNotImplementedError: Flight returned unimplemented error, with message: Not yet implemented

That's probably related to IOx not yet implementing a few Flight operations.

@arunjose696
Copy link
Author

@nightscape

I got this error . When using insecure parameter in my windows machine.

pyarrow._flight.FlightUnavailableError: Flight returned unavailable error, with message: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8086: Trying to connect an http1.x server

@nightscape
Copy link

It looks like you're trying to connect to a InfluxDB 1.x or 2.x. I think Flight only works with IOx which would have port 8083 for the gRPC calls.

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

No branches or pull requests

2 participants