Import from SQL

You can import data from specified database connection and using SQL SELECT statement result data. Data import is similar to Excel and CSV file upload and Import from REST API. You can also schedule regular daily import from provided SQL SELECT statement results.

Please at first read about eazyBI cubes, dimensions and measures - you will need to understand multi-dimensional data model to be able to map source file columns to cube dimensions and measures.

On this page:

Create new source application

Go to Source Data tab and Add new source application and select SQL application type.

If you have created already another similar SQL data source then you can export its definition and paste it in Import definition to create new SQL source application with the same parameters.

SQL source parameters

In the next step you will need to provide SQL source parameters which will be used to retrieve the data. See example:

In Database type select database server type (MySQL, PostgreSQL, MS SQL and Oracle are supported).

In Private eazyBI you can select also Generic JDBC database type and specify JDBC driver class name and JDBC URL. Please copy corresponding JDBC driver jar file to eazybi_private/lib directory and restart Private eazyBI after that.

Specify database server Host and optional Port parameter (depending on selected database type some other optional parameters might be available). Specify Database name and database Username and Password that should be used.

Enter SQL SELECT statement which should be used to retrieve the data. Before SQL SELECT statement you can add SQL comment (either start line with -- or enclose in /* and */) and then this comment will be shown also in Source Data source applications list (can be useful if many SQL SELECT sources are used in the same account).

Incremental import

Available from the eazyBI version 4.6 and in eazyBI Cloud.

By default, SQL import will always re-import all data. During the import the old imported data will be deleted and then replaced by new returned data. If SQL SELECT returns many rows then each data import might take long time as well as reports might return incomplete data while the old data are deleted and not all new data are imported.

If you would like to use incremental import to update just the recent source data after the initial full import, then click Incremental import parameters and enable it:

In addition, specify the incremental import WHERE conditions in the SELECT statement. Use special -- if incremental-- else-- end comments (as shown in the example) to specify which lines should be included only for the incremental import and which lines only for the full import. Typically you need to specify a condition that filters just recently updated rows using the corresponding date column.

If incremental import is used then it will be required to specify a Source ID column in the source columns mapping step. Source ID column value should provide a unique results row identifier. It is used to identify when some existing imported rows in eazyBI should be replaced with updated source data during the incremental import.

If you have previously imported all data without the incremental import option, then it will not be possible to modify the source columns mapping. Therefore, at first delete all imported data for this SQL source, and then modify the source columns mapping and specify the Source ID column.

Source columns mapping

SQL source columns mapping is similar to Excel or CSV file columns mapping and Import from REST API. Please review these documentation pages to learn more about columns mapping to eazyBI dimensions and measures.

See example of SQL SELECT columns mapping:

After mapping all necessary columns you can click Start import. If there will be any mapping errors then they will be shown and columns with errors will be highlighted. If you need to save draft of mapping then click Back to edit and confirm that you want to save changes.

Importing of source data

If source columns mapping was saved without any validation errors then SQL source application will be queued for background import. You will see the updated count of imported rows during the import:

You can later visit Source Data tab again and click Import button again to import the latest data from SQL source. During each import it will at first delete all data that were imported previously from this source and then import new data. In addition you can also click Delete data to delete imported data from this source (you need to delete imported data also if you want to change source columns mapping).

Export definition

As it was mentioned in the beginning you can export SQL source application definition by clicking Export definition from Source Data tab source application listing and then copy this definition and paste in Import definition field when creating different source application.

If you need any help with SQL source data import then please contact  eazyBI support.