You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "geyungjen (via GitHub)" <gi...@apache.org> on 2023/08/10 20:06:37 UTC
[GitHub] [arrow] geyungjen opened a new issue, #37113: pyarrow.lib.ArrowInvalid: Unable to parse command
geyungjen opened a new issue, #37113:
URL: https://github.com/apache/arrow/issues/37113
### Describe the usage question you have. Please include as many useful details as possible.
I have a flight SQL server running against a relational database, the client I wrote with C/C++ works fine:
In my C++ client, when I embed the following command:
ARROW_ASSIGN_OR_RAISE(auto info, sql_client->Execute(call_options, "select 1, cast(3.14 as float), cast(Now() as text), 2 , cast('hello' as text), 3, cast('world' as text) ;"))
It works and gives me the result:
Schema:?column?: int32
float8: double
now: string
?column?: int32
text: string
?column?: int32
text: string
?column?: [
1
]
float8: [
3.14
]
now: [
";2023-08-10 12:56:12.10774-07"
]
?column?: [
2
]
text: [
hello"
]
?column?: [
3
]
text: [
world"
]
The above is not an issue.
The issue is with PyArrow, I got following error:
Traceback (most recent call last):
File "/Users/user/Documents/ml_spark/python_test/PyArrow/main.py", line 69, in <module>
flight_info=client.get_flight_info(descriptor=flight.FlightDescriptor.for_command("select 1;"), options=options)
File "pyarrow/_flight.pyx", line 1527, in pyarrow._flight.FlightClient.get_flight_info
File "pyarrow/_flight.pyx", line 78, in pyarrow._flight.check_flight_status
File "pyarrow/error.pxi", line 100, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: Unable to parse command
Here is the Python code in Pycharm:
ef print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press ⌘F8 to toggle the breakpoint.
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
print_hi('PyCharm')
username = 'sysdba'
password = 'hello'
sql = 'select 1'
location=flight.Location('grpc://10.0.0.109:15432')
client = flight.connect(location)
token_pair = client.authenticate_basic_token(username=username,password=password)
headers = [token_pair]
print(headers)
options = flight.FlightCallOptions(headers=headers)
flight_info=client.get_flight_info(descriptor=flight.FlightDescriptor.for_command("select 1;"), options=options)
reader = client.do_get(flight_info.endpoints[0].ticket, options)
print(reader.read_pandas())
It outputs:
Hi, PyCharm
[(b'authorization', b'Bearer 12630926897980691830')]
Traceback (most recent call last):
File "/Users/user/Documents/ml_spark/python_test/PyArrow/main.py", line 69, in <module>
flight_info=client.get_flight_info(descriptor=flight.FlightDescriptor.for_command("select 1;"), options=options)
File "pyarrow/_flight.pyx", line 1527, in pyarrow._flight.FlightClient.get_flight_info
File "pyarrow/_flight.pyx", line 78, in pyarrow._flight.check_flight_status
File "pyarrow/error.pxi", line 100, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: Unable to parse command
Authentication was successful, returns Bearer and session id.
What is failed is:
flight_info=client.get_flight_info(descriptor=flight.FlightDescriptor.for_command("select 1;"), options=options)
with following error:
File "/Users/user/Documents/ml_spark/python_test/PyArrow/main.py", line 69, in <module>
flight_info=client.get_flight_info(descriptor=flight.FlightDescriptor.for_command("select 1;"), options=options)
File "pyarrow/_flight.pyx", line 1527, in pyarrow._flight.FlightClient.get_flight_info
File "pyarrow/_flight.pyx", line 78, in pyarrow._flight.check_flight_status
File "pyarrow/error.pxi", line 100, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: Unable to parse command
Thanks
George Jen
### Component(s)
Python
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] lidavidm commented on issue #37113: pyarrow.lib.ArrowInvalid: Unable to parse command
Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #37113:
URL: https://github.com/apache/arrow/issues/37113#issuecomment-1673900997
There's not a Flight **SQL** client in Python, either use the [ADBC Flight SQL driver](https://arrow.apache.org/adbc/0.5.1/driver/flight_sql.html) or manually encode the query into the Flight SQL messages.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] pyarrow.lib.ArrowInvalid: Unable to parse command [arrow]
Posted by "thisisnic (via GitHub)" <gi...@apache.org>.
thisisnic commented on issue #37113:
URL: https://github.com/apache/arrow/issues/37113#issuecomment-2966759824
This issue appears to be stale or discussion appears to be concluded, so I'm going to close it for now. Please feel free to reopen if it's still relevant or you'd like to continue the discussion.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] pyarrow.lib.ArrowInvalid: Unable to parse command [arrow]
Posted by "thisisnic (via GitHub)" <gi...@apache.org>.
thisisnic closed issue #37113: pyarrow.lib.ArrowInvalid: Unable to parse command
URL: https://github.com/apache/arrow/issues/37113
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org