diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 438dbd4ee..5c4697dd3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,6 +4,9 @@ Note that this section targets contributors and those who wish to set up and run If you're interested in using the distributed App, [download the latest release.](https://github.com/plotly/falcon-sql-client/releases) +## Prerequisites +It is recommended to use node v6.12 with the latest electron-builder + ## Install Start by cloning the repo via git: @@ -125,3 +128,14 @@ $ yarn run test-e2e - Mac builds are created in TravisCI tests and automatically hosted on [amazon](https://s3.console.aws.amazon.com/s3/buckets/falcon-travis-artifacts/plotly/falcon-sql-client/?region=us-east-1&tab=overview). Select the latest build (largest number *note:* the folders are not necessarily sequential) -> release.zip Builds are uploaded to https://github.com/plotly/falcon-sql-client/releases. + +## Troubleshooting +The Falcon Configuration information is installed in the user's home directory. +For example Unix and Mac (~/.plotly/connector) and for Windows (%userprofile%\.plotly\connector\). If you have tried the install +process and the app is still not running, this may be related to some corrupted +configuration files. You can try removing the existing configuration files and then +restarting the build process + +```bash +rm -rf ~/.plotly/connector/ +``` \ No newline at end of file diff --git a/NEW_CONNECTION.md b/NEW_CONNECTION.md new file mode 100644 index 000000000..1562599b6 --- /dev/null +++ b/NEW_CONNECTION.md @@ -0,0 +1,106 @@ +# Add New Data Source + +## Images +The connector must provide an icon to be displayed on the selection tab and +it is recommended to add the images as png format. +Please verify that the icon looks good with the following CSS specs: +```css + max-width: 100px; + max-height: 70px; +``` + +## Updating the constants.js file +The following are the instructions for updating the Constants File: +1. Add an entry in DIALECTS +2. Add an entry in SQL_DIALECTS_USING_EDITOR +3. Add an entry under CONNECTION_CONFIG +4. Add the location logo into the LOGOS Constants +5. Add the preview query in the PREVIEW_QUERY section +6. Add sample credentials for your connector in the SAMPLE_DBS + +## Updating the Tab.react.js +The following are the instructions for updating the Tab React JS file +1. Customise the label for your connector in the render function: + +```javascript + let label; + if (dialect === DIALECTS.S3) { + label = `S3 - (${connectionObject.bucket})`; + } else if (dialect === DIALECTS.NEW_CONNECTION) { + //Specify the label + label = `NEW CONNECTION (${connectionObject.host})`; + } + .... +``` + +## Updating the Settings.react.js +Update the fetchData function to make the calls to appropriate sessions.js backend. +Add your new connection to the following list: + +```javascript + if (contains(connectionObject.dialect, [ + DIALECTS.APACHE_IMPALA, + DIALECTS.APACHE_SPARK, + DIALECTS.IBM_DB2, + DIALECTS.MYSQL, DIALECTS.MARIADB, DIALECTS.POSTGRES, + DIALECTS.REDSHIFT, DIALECTS.MSSQL, DIALECTS.SQLITE + ])) { +``` + +## New Datastore file +This file should be added in the following location +backend/persistent/datastores + +```javascript + +/** + * The following function will connect to the datasource + * @param {Object} connection + * @returns {Promise} that resolves when the connection succeeds + */ +function connect(connection); + +/** + * The following function will return a list of schemas. + * @param {Object} connection + * @returns {Promise} that resolves to { + * columnnames: [ 'tablename', 'column_name','data_type' ], + * rows: [[tablename1, columnname1, datatype1], ...]] } + */ +function schemas(connection); + +/** + * The following function will return a list of tables. + * The return result should an array of strings + * @param connection {object} + * @returns {Promise} that resolves to an array of table names + */ +function tables(connection); + +/** + * The following function will execute a query against the + * data source. The function should return a tuple which contains + * two elements. The first is an array of strings which is the column names + * The second is a two dimensional array which represents the rows to be displayed + * @param {string|object} queryObject + * @param {object} connection + * @returns {Promise} that resolves to { columnnames, rows } + */ +function query(queryObject, connection); + +``` + +## Updating the Datastores.js +The following are the instructions for updating the Datastores.js + +1. Import the new Data source file +2. Update the function getDatastoreClient +``` javascript + //The dialect name must match what was specified under + //app/constants/constants.js for the Dialect name + } else if (dialect === 'new dialect') { + return MyNewDialect; + } +``` +# Development and Debugging Setup +TBD