![]() |
VOOZH | about |
The Apache Solr platform is a popular, blazing-fast, open source enterprise search solution built on Apache Lucene.
Apache Solr is equipped with the Data Import Handler (DIH), which can import data from databases and, XML, CSV, and JSON files. When paired with the CData JDBC Driver for Presto, you can easily import Presto data to Apache Solr. In this article, we show step-by-step how to use CData JDBC Driver in Apache Solr Data Import Handler and import Presto data for use in enterprise search.
Accessing and integrating live data from Trino and Presto SQL engines has never been easier with CData. Customers rely on CData connectivity to:
Presto and Trino allow users to access a variety of underlying data sources through a single endpoint. When paired with CData connectivity, users get pure, SQL-92 access to their instances, allowing them to integrate business data with a data warehouse or easily access live data directly from their preferred tools, like Power BI and Tableau.
In many cases, CData's live connectivity surpasses the native import functionality available in tools. One customer was unable to effectively use Power BI due to the size of the datasets needed for reporting. When the company implemented the CData Power BI Connector for Presto they were able to generate reports in real-time using the DirectQuery connection mode.
> solr create -c CDataCoreFor this article, Solr is running as a standalone instance in the local environment and you can access the core at this URL: http://localhost:8983/solr/#/CDataCore/core-overview
PrestoUniqueKeyπ Define schema in Solr for Presto data.
Now we are ready to use Presto data in Solr.
In this section, we walk through configuring the Data Import Handler.
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-dataimporthandler-.*\.jar" />
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">solr-data-config.xml</str>
</lst>
</requestHandler>
<dataConfig>
<dataSource driver="cdata.jdbc.presto.PrestoDriver" url="jdbc:presto:Server=127.0.0.1;Port=8080;">
</dataSource>
<document>
<entity name="Customer"
query="SELECT Id,PrestoColumn1,PrestoColumn2,PrestoColumn3,PrestoColumn4,PrestoColumn5,PrestoColumn6,PrestoColumn7,LastModifiedDate FROM Customer"
deltaQuery="SELECT Id FROM Customer where LastModifiedDate >= '${dataimporter.last_index_time}'"
deltaImportQuery="SELECT Id,PrestoColumn1,PrestoColumn2,PrestoColumn3,PrestoColumn4,PrestoColumn5,PrestoColumn6,PrestoColumn7,LastModifiedDate FROM Customer where Id=${dataimporter.delta.Id}">
<field column="Id" name="Id" ></field>
<field column="PrestoColumn1" name="PrestoColumn1" ></field>
<field column="PrestoColumn2" name="PrestoColumn2" ></field>
<field column="PrestoColumn3" name="PrestoColumn3" ></field>
<field column="PrestoColumn4" name="PrestoColumn4" ></field>
<field column="PrestoColumn5" name="PrestoColumn5" ></field>
<field column="PrestoColumn6" name="PrestoColumn6" ></field>
<field column="PrestoColumn7" name="PrestoColumn7" ></field>
<field column="LastModifiedDate" name="LastModifiedDate" ></field>
</entity>
</document>
</dataConfig>> solr stop -all > solr start
Using the CData JDBC Driver for Presto you are able to create an automated import of Presto data into Apache Solr. Download a free, 30 day trial of any of the hundreds of CData JDBC Drivers and get started today.
Download a free trial of the Presto Driver to get started:
Download NowLearn more:
π Presto IconRapidly create and deploy powerful Java applications that integrate with Presto.