3 Creating Datasources and Database Collectors
- Chris Welford
- Anthony George
- Zoe Baldwin
Owned by Chris Welford
By the end of this page you will be able to:
Create a new datasource
You will now add a new datasource to your Introduction to Modelling analysis model to connect to an external database.
Hover your mouse over Databases in the toolbar to show the list of options.
Drag a Datasource onto the model.
Can't see this?- You may need to press More Options, next to Database Collector in the toolbar, to show the Datasource option.
- In the new datasource settings form that opens, enter the Name:
CRM
- In the settings, click Apply.
- PhixFlow adds the new datasource to your model. In the model toolbar, click Save.
- You will now add more settings to the datasource.
- In the Basic Settings section:
- Enabled:
- Database Driver: Select
MariaDB
- The Datasource Instances section has its own toolbar. Click Insert. PhixFlow opens the settings for a new datasource instance. Set:
- Name:
Default
- Enabled:
- Authorisation Type: Local
- For the following settings see your training welcome email:
- URL: See welcome email
- Username: See welcome email
- Password: See welcome email
- Click Apply and Close to finish and close the datasource instance settings.
- Name:
- Back in the datasource settings, click Apply and Close to finish and close.
Create a database collector from the datasource schema browser
- In your model, hover your mouse pointer over the CRM Datasource icon you just created. In the popup toolbar, click Show Tables
- In the list of tables that PhixFlow opens, scroll down to the SOURCE_CUSTOMER_PHONE_NUMBERS table name.
- To have a look at the data in this table, double-click its name.
- You can see there are columns for ##CUSTOMER_REF and ##PHONE_NUMBER.
- Close this data form
- Right-click
SOURCE_CUSTOMER_PHONE_NUMBERS
and in the popup menu, select Create a Collector. PhixFlow adds a new Database Collector to your model, which reads data from the table SOURCE_CUSTOMER_PHONE_NUMBERS.- If the database collector settings are not already open on the right, double-click on the new database collector to open its settings.
- In the Basic Settings section → Statement Expression field, you can see that PhixFlow has added a database query.
- Close the database collector settings.
- In the model toolbar, click Save.
Create a table automatically from a database collector
- Hover your mouse pointer over the SOURCE_CUSTOMER_PHONE_NUMBERS Database Collector you just created.
- In the popup toolbar, click Create a new Table using the attributes returned from the query. PhixFlow adds the new table to your model.
- In the model window, click Save.
Run analysis and view the table data
- Hover your mouse pointer over your new SOURCE_CUSTOMER_PHONE_NUMBERS table, and in the popup toolbar click Run Analysis.
- To view the data you just loaded, hover over the table and click Show the list of Views.
- The SOURCE_CUSTOMER_PHONE_NUMBERS (Default View) window will show like the image below:
- In the model window, click Save.
Check Point
At this point your screen should look like this: