{"id":2070,"library":"impyla","title":"Impyla","description":"Impyla is a Python client for HiveServer2 implementations, such as the Impala distributed query engine. It provides a Python DB API 2.0 (PEP 249)-compliant interface, enabling Python applications to connect to Impala and execute SQL queries. The library, currently at version 0.22.0, is actively maintained by Cloudera with a regular, though somewhat irregular, release cadence, often including alpha and stable versions within a year.","status":"active","version":"0.22.0","language":"en","source_language":"en","source_url":"https://github.com/cloudera/impyla","tags":["Impala","Hive","DB API","SQL","Big Data","Cloudera","Thrift","Hadoop"],"install":[{"cmd":"pip install impyla","lang":"bash","label":"Install latest stable version"}],"dependencies":[{"reason":"Requires Python 2.7+ or 3.5+","package":"python","optional":false},{"reason":"Required for core functionality","package":"six","optional":false},{"reason":"Required for core functionality","package":"bitarray","optional":false},{"reason":"Required for Thrift protocol communication","package":"thrift==0.16.0","optional":false},{"reason":"Required for SASL authentication","package":"thrift_sasl==0.4.3","optional":false},{"reason":"Optional, for Kerberos over HTTP support (requires system Kerberos libraries)","package":"kerberos","optional":true},{"reason":"Optional, alternative for Kerberos on Windows","package":"winkerberos","optional":true},{"reason":"Optional, for converting query results to DataFrames","package":"pandas","optional":true},{"reason":"Optional, for SQLAlchemy engine integration","package":"sqlalchemy","optional":true}],"imports":[{"symbol":"connect","correct":"from impala.dbapi import connect"}],"quickstart":{"code":"import os\nfrom impala.dbapi import connect\n\nIMPALA_HOST = os.environ.get('IMPYLA_TEST_HOST', 'localhost')\nIMPALA_PORT = int(os.environ.get('IMPYLA_TEST_PORT', 21050))\n\ntry:\n    conn = connect(host=IMPALA_HOST, port=IMPALA_PORT)\n    cursor = conn.cursor()\n    cursor.execute('SHOW TABLES')\n    tables = cursor.fetchall()\n    print('Tables in Impala:')\n    for table in tables:\n        print(table[0])\n    cursor.close()\n    conn.close()\nexcept Exception as e:\n    print(f\"Could not connect or query Impala: {e}\")\n    print(\"Please ensure an Impala daemon is running at the specified host and port.\")","lang":"python","description":"This quickstart demonstrates how to establish a connection to an Impala server, execute a simple SQL query, and fetch the results using the DB API 2.0 interface. It uses environment variables for host and port for flexibility."},"warnings":[{"fix":"To restore the old behavior for `close_finished_queries`, set `close_finished_queries=False` when creating a Cursor object. Note that `Cursor.rowcount` only works with Impala server; it will return -1 for Hive.","message":"In version 0.20.0, the behavior of `Cursor.rowcount` and the automatic closing of finished queries (`close_finished_queries`) changed. This might be a breaking change for existing applications.","severity":"breaking","affected_versions":"0.20.0 and later"},{"fix":"Always specify `port=21050` (or your configured HiveServer2 port) in the `connect()` function.","message":"When connecting to Impala via Impyla, ensure you use the HiveServer2 port (default 21050). Using the Beeswax port (default 21000), which the Impala shell typically uses, will result in connection errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Pin the `bitarray` dependency to a known compatible version if you encounter `bitarray`-related errors, for example, `bitarray<2.1.0`.","message":"Impyla has been reported to break with newer versions of the `bitarray` library (e.g., version 2.1.0). Compatibility issues may arise if `bitarray` is updated beyond tested versions.","severity":"gotcha","affected_versions":"Potentially 0.19.0 and later (unconfirmed exact range, report seen for 'newer version')"},{"fix":"Consider using Python versions prior to 3.12, or monitor GitHub for updated compatibility with Python 3.12 and later.","message":"Python 3.12 support is incomplete in Impyla versions up to 0.22.0. A known issue is that installation using `setuptools` may fail with Python 3.12.","severity":"gotcha","affected_versions":"Up to 0.22.0"},{"fix":"Remove the `auth_cookie_names` parameter from your `connect()` calls. If you explicitly set it to `None` for GSSAPI authentication in older versions, note that the auth cookie will be enabled after upgrading to 0.18.0 or newer.","message":"The `auth_cookie_names` parameter in the `connect()` API was deprecated in version 0.18.0. Authentication cookie functionality is now enabled by default.","severity":"deprecated","affected_versions":"0.18.0 and later"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}