druid-io / pydruid

A Python connector for Druid
Other
506 stars 194 forks source link

Support hyperUnique type #131

Closed betodealmeida closed 6 years ago

betodealmeida commented 6 years ago

Druid has a column type hyperUnique that can be used in COUNT(DISTINCT $expr). I added a mapping between the column type so it shows up as a BLOB in SQLAlchemy.

I tested the code by running a query on a hyperUnique column, session_id:

from sqlalchemy.engine import create_engine

engine = create_engine('druid+https://XXXXXXXXXX:443/druid/v2/sql/')
with engine.connect() as conn:
    res = conn.execute('SELECT COUNT(DISTINCT session_id) AS sessions FROM hive_query_logged')

print(list(res))
mkuthan commented 6 years ago

Thanks for this fix! When do you plan to release new version? This issue is a root cause that Superset is not able to fetch metadata for tables with hyperUnique columns.

mistercrunch commented 6 years ago

I just released 0.4.3 to pypi