Initial commit

This commit is contained in:
Tim_Doernemann 2026-05-28 17:44:11 +02:00
parent d4028fca11
commit a578239c4f
32 changed files with 2559 additions and 0 deletions

View file

@ -0,0 +1,42 @@
"""
Copyright (C) 2017-2021 Dremio Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from dremio.arguments.parse import options_default_validator
from dremio.flight.endpoint import DremioFlightEndpoint
def execute_query(dremio_host: str, dremio_port: int, username: str, token: str, query: str):
args = {
'hostname': dremio_host,
'port': dremio_port,
'tls': True,
'username': username,
'token': token,
'query': query
}
config = options_default_validator["default"] | args
# Instantiate DremioFlightEndpoint object
dremio_flight_endpoint = DremioFlightEndpoint(config)
# Connect to Dremio Arrow Flight server endpoint.
flight_client = dremio_flight_endpoint.connect()
# Get reader
reader = dremio_flight_endpoint.get_reader(flight_client)
# Print out the data as a dataframe
print(reader.read_pandas())