Download and Install the Plotly Database Connector App
Please note that SQLite currently is supported on Mac OS only. Linux and Windows support will come shortly. Thank you for your patience.
Simply Download the app to get started!
Launch and Connect
Having launched the app, select SQlite by clicking on its icon.
Click on the path to database input field and a dialog window will open. Navigate to your local database file (having a .db extension). If your data is in csv format, convert it first to a database .db file.
The dialog menu will only allow you to select a database .db file.
Finally, click on the connect button!
Choose A Database
Once connected, a dropdown menu will appear. When using sqlite, the .db file itself is the one and only database which will contain one or many tables. Thus the database dropdown menu will be greyed out since there are no choices of databases. Your connection to it is established and the preview of each table are displayed.
Preview Your Tables
A dropdown menu will appear. The options are the tables of the database previously selected. Select the table you wish to preview (see the top 5 rows of the table).
Scroll down to to see the full table if it does not fit in the preview window.
Send a Query to Your Database
Once you have successfully certified your database credentials and you have an automatically generated an SSL, you are setup to begin querying data in Plotly. It is important to note that the automatically generated SSL can sometimes take up to several minutes, but don't worry, this authorization only needs to be completed once. Once you can see that is has been generated, click the 'Click to Open Query Editor' link under the 'Final Step. Query Data on Plotly' section. This will open the Plotly workspace in your default browser.
Now, the SQL import modal will appear. Simply, clik 'Next'
Verify that both 'https' is selected and your unique address is in the text box. Then click Connect
Once connected, you will see an SQL editor along with a database dropdown menu. Select the database from the dropdown menu to connect to that database. In this example, let's use plotly_datasets.
Having selected a database from the dropdown menu, a query will appear on the first line of the editor. Modify it until you are satisfied with the data that you are querying from your database. For this example, let's quickly import all of the data from the agricultural imports table us_ag_exports_2011. Enter the query SELECT * FROM us_ag_exports_2011. Where * is a SQL keyword for 'all'.
To execute the query, click on RUN QUERY button.
Your data will be imported into the grid below. You can now create a plot using the imported data from your SQL database.
Making a plot!
Let's visualize the beef exports by state on a map. On the left side, the GRAPH tab should be selected. Here you can choose the Chart Type drop down menu. Choose Choropleth. As for Locations, choose the state column. Finally, set the Values to be the beef column.
Since our code column data is in three letter state codes, select the Location Format to be USA State Abbreviations. We are only looking at USA data here, so for the Map Region option select USA. Finally, let's keep it simple and keep the Projection option as the default Albers USA. Come back later to explore more options.
Look to the right! You graph should be already updated. Why not add a title? Click into the empty field above the graph and enter a description.
Let's not lose all this work! Let's save the graph. Click on the SAVE tab on the left.
You will be prompted to choose your privacy settings for this graph and data. There is nothing here to classify, let's simply set both plot and data to public. Click SAVE.
Let's share this interactive plot with a friend or a coworker (or both)! Click on the SHARE tab on the left.
The fastest way is to send the Shareable Link, copy and paste it into your favorite e-mail or other communication service. Try out our Twitter, Facebook and Google+ links as well or embed it into your website by obtaining the iframe link in the Embed tab. If you set the settings to public previously, your friend or coworker will be able to view it even without an account and give you feedback.
When your are finished creating graphs using the data from your database, disconnect by moving your mouse onto the Connected button in the Plotly Database Connector and click when it says Disconnect.