Introduction
Exporting data from a database requires three modelling objects:
- Table: The location(s) in PhixFlow which holds the data required for export.
- Data Exporter: sends data to the datasource using a SQL command.
- Datasource: Provides the connection to the database.
Solution
1. Table
- Hover over the Database Collector and Table and from the popup menu click
Insert excerpt |
---|
| _tabledatabase_with_attributesexporter |
---|
| _tabledatabase_with_attributesexporter |
---|
nopanel | true |
---|
|
. - The Data Exporter is created and a property editor opens on the right. Alternatively a Data Exporter can be dragged onto the canvas from the Toobar.
2.
A table now exists ready hold imported data in PhixFlow.To import the data hover over the table and click Database Collector
- In the property editor complete the details:
- Name, Provide a name that is indicative of the data being exported.
- Enabled, Tick this option.
- Datasource, This option specifies where the data will be written. You can use an existing Datasource or see step 3 below for creating a new one.
- Statement Expression, is the SQL statement that will be used to insert or update the data in your database. Attributes from your table are referenced with pipe.attribute.
- Insert Example: INSERT INTO MyTable values ({in.Name})
- Update Example: UPDATE MyTable SET Name = {in.Name} WHERE UID = {in.UID}
- Save run_analysisrun_analysis.
- To remove any imported data see Removing Recordsets.
2. Setting up the Datasource
- From the Create section of the toolbar click Database.
- Drag your changes.
3. Setting up the Data source
A Datasource is a connection it can be used to both collect and export data.
If you have an existing data source;
- click on the Datasource icon in the toolbar.
- From the list that appears, drag the required Datasource onto your canvas.
- If you have specified a required Datasource in your data exporter it will automatically connect to it.
If you are creating a new Datasource;
- From the toolbar drag a Datasource onto the canvas.
- In the properties window that opens on the right set the following:
- Enter a NameName, Indicative of the datasource you are connecting to.
- Select a Database Driver, Select the appropriate database.
- Add a datasource instanceDatasource instance, add a new one:
- Enter a Name.
- Enter the URL for the database.
- Specify the Username and Password.
- Tick the Enabled check box when it is ready to use.
- Tick the Enabled check box when it is ready to use.
- We recommend you tick Protect during import to prevent this datasource being updated or deleted during import.
- Other settings are optional.
- Save
Insert excerpt |
---|
| _finish |
---|
| _finish |
---|
nopanel | true |
---|
|
your changes.
2. Database Collector
Hover over the datasource and click Insert excerpt |
---|
_datasource_show_tables | _datasource_show_tables | nopanel | true |
, all available tables will be listed.Right click on the desired table and click create a collector.A database collector is created and set to import all data.If you wish to edit what data is retrieved, edit the Statement Expression in the properties window open on the right. For more information on editing the Statement Expression see Database Collector.Save Insert excerpt |
---|
_finish | _finish | nopanel | true |
your changes.3See Datasource.