Connect to your database

So far, you could only create a dataset by uploading a CSV file. But let's face it, every business has a huge amount of data stored in various databases, so why bother with CSV. Depending on the employer's request, various systems sort data and extract the most important from them using SQL. Lucky for you, with Graphite, you can connect to your database and write your own SQL. Let's figure out how to do it.

Graphite Note - select database connection

As soon as you log in to Graphite, go to Datasets and click on Create New. You can choose a connection to MySQL/MariaDB or PostgreSQL database. While other connections are being developed, such as MS SQL, Amazon RedShift, etc., there is a little hack: in case your only data source is RedShift, just create a PG connection with Redshift parameters and the connection should work.

Graphite Note - define dataset name

After selecting a connection, define the name for your dataset. Additionally, you can write a description, or select/create a tag.

Graphite Note - establish a connection

Now we come to the most important part, establishing a connection. You have to enter your server hostname or IP address, database port, database user, database password, and database name. After that, click the Check Connection button. To enable the connection to your database, please ensure that your firewall accepts incoming requests from the following two IP addresses: 35.158.125.4 and 68.183.64.54.

Graphite Note - write SQL

After your connection is established, it's time to show us your SQL knowledge - write the desired SQL and click the Run SQL button to get your data.

Graphite Note - check columns

By scrolling down, all the columns from the selected dataset will appear. If necessary, you can change column names, data type, or data format; click on the Create button to create your dataset. It's much easier to get data from databases using SQL - you adjust the dataset to your needs! By repeating the above steps, you can easily get your data and start running various models without writing down any line of code. 🙂







How to re-upload CSV files

Have you collected more data related to your uploaded CSV or there has been a change in the data you have uploaded? Don't worry, we thought about that and added a re-uploading option.

For example, if the new data is in the CSV file along with the old data (the ones you uploaded), you can re-upload it as a fresh new dataset. The same thing should be done if there has been a change in the uploaded data. On the other hand, if the new data you want to add is in another CSV file (not along with the uploaded data), you can append it to the previous dataset. But there is a small catch thou: the file you selected must have the same column structure as the previous (uploaded) file!

To re-upload your data, you have to

  1. Go to Datasets list
  2. Select the dataset you want to re-upload
  3. Select Re-upload
  4. Depending on your needs, you can select Append data
  5. Select or drop your CSV file
  6. Select Update

For example, this is a useful thing for monthly data. Imagine getting a CSV file with certain data every month and you need to merge the data for all the months into one CSV file. Instead of repeating the copy and paste commands, with a few clicks you just add data to an existing dataset and so on every month. Ta-da, your new dataset is ready! 🙂