ElasticsearchSQLHook¶
Elasticsearch 钩子,通过 elasticsearch-dbapi 与 Elasticsearch 交互
使用示例¶
es = ElasticsearchSQLHook(elasticsearch_conn_id=CONN_ID)
# Handle ES conn with context manager
with es.get_conn() as es_conn:
tables = es_conn.execute("SHOW TABLES")
for table, *_ in tables:
print(f"table: {table}")
return True