{"library":"sqlalchemy-dremio","title":"SQLAlchemy Dremio","type":"library","description":"SQLAlchemy Dremio is a SQLAlchemy dialect that enables connecting to Dremio via its Apache Arrow Flight interface. It's actively maintained, with the current stable version being 3.0.5, and generally follows a release cadence tied to Dremio Flight client updates and SQLAlchemy compatibility.","language":"python","status":"active","last_verified":"Thu Apr 16","install":{"commands":["pip install sqlalchemy-dremio","pip install sqlalchemy-dremio[pandas]"],"cli":null},"imports":[],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/narendrans/sqlalchemy_dremio","docs":null,"changelog":null,"pypi":"https://pypi.org/project/sqlalchemy-dremio/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import sqlalchemy\nimport os\n\n# Configure Dremio connection details using environment variables for security\nDREMIO_HOST = os.environ.get('DREMIO_HOST', 'localhost')\nDREMIO_PORT = os.environ.get('DREMIO_PORT', '32010')\nDREMIO_USER = os.environ.get('DREMIO_USER', 'dremio_user')\nDREMIO_PASS = os.environ.get('DREMIO_PASS', 'dremio_password')\nDREMIO_CATALOG = os.environ.get('DREMIO_CATALOG', 'DREMIO') # e.g., 'DREMIO' or your space name\nUSE_SSL = os.environ.get('DREMIO_USE_SSL', 'true').lower() == 'true'\n\n# Construct the connection string\nconnection_string = (\n    f\"dremio+flight://{DREMIO_USER}:{DREMIO_PASS}@{DREMIO_HOST}:{DREMIO_PORT}/\"\n    f\"{DREMIO_CATALOG}?USE_SSL={str(USE_SSL).lower()}\"\n)\n\nprint(f\"Connecting to: {connection_string.split(DREMIO_PASS)[0]}*****@{DREMIO_HOST}:{DREMIO_PORT}/{DREMIO_CATALOG}...\")\n\ntry:\n    # Create the SQLAlchemy engine\n    engine = sqlalchemy.create_engine(connection_string)\n\n    # Establish a connection and execute a simple query\n    with engine.connect() as connection:\n        # Ensure you have a table accessible, e.g., 'sys.version'\n        result = connection.execute(sqlalchemy.text(\"SELECT * FROM sys.version\"))\n        \n        # Fetch and print results\n        print(\"\\nQuery Results:\")\n        for row in result:\n            print(row)\n\n    print(\"\\nSuccessfully connected to Dremio and executed a query.\")\n\nexcept Exception as e:\n    print(f\"\\nError connecting to Dremio or executing query: {e}\")\n    print(\"Please ensure Dremio is running, credentials are correct, \")\n    print(\"and the Flight endpoint is accessible (often port 32010, sometimes with SSL).\")\n","lang":"python","description":"This quickstart demonstrates how to establish a connection to Dremio using `sqlalchemy-dremio` via the Flight interface and execute a basic query. It uses environment variables for secure credential handling and highlights common connection string parameters like host, port, user, password, catalog, and SSL settings.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}