Search code examples
databasedashboardigniteredash

How to configure Apache Ignite in Redash


I need to configure Apache ignite in Redash for BI dashboard but couldn't figure out how to do the same since there is no direct support for ignite in Redash.


Solution

  • It is possible using Python query runner, which is available for stand-alone installs only. It allows you to run arbitrary Python code, in which you can query Apache Ignite via JDBC.

    First, add redash.query_runner.python query runner to settings.py: add query runner

    and install Python JDBC bridge module together with dependencies:

    sudo apt-get install python-setuptools
    sudo apt-get install python-jpype
    sudo easy_install JayDeBeApi
    

    Then after VM restart you should add Python data source (you might need to tweak module path): add data source

    And then you can actually run the query (you will need to provide Apache Ignite core JAR and JDBC connection string as well): edit query

    import jaydebeapi
    conn = jaydebeapi.connect('org.apache.ignite.IgniteJdbcThinDriver', 'jdbc:ignite:thin://localhost', {}, '/home/ubuntu/.m2/repository/org/apache/ignite/ignite-core/2.3.2/ignite-core-2.3.2.jar')
    curs = conn.cursor()
    curs.execute("select c.Id, c.CreDtTm from TABLE.Table c")
    data = curs.fetchall()
    
    result = {"columns": [], "rows": []}
    add_result_column(result, "Id", "Identifier", "string")
    add_result_column(result, "CreDtTm", "Create Date-Time", "integer")
    
    for d in data:
            add_result_row(result, {"Id": d[0], "CreDtTm": d[1]})
    

    Unfortunately there's no direct support for JDBC in Redash (that I'm aware of) so all that boilerplate is needed.