top of page
Search

Day 5 - Export data from PostgreSQL(Part 1)

  • Writer: Suzie Ji
    Suzie Ji
  • Jan 31, 2021
  • 1 min read

Updated: Apr 14, 2021



Method 1:

$ docker ps
#List the name of the docker image.
$ docker exec -it <image name> /bin/bash
#I can enter the shell of each docker image
$ docker exec -it canvas-lms_web_1 /bin/bash

This method has no results.


Method 2:

Another method is to export data from PostgreSQL.

Use Canvas' CLI tool to capture data from PostgreSQL.

A small CLI tool for syncing data from the Canvas Data API.

Canvas data is written in JSON. If you want to import to Incorta, I need to change JSON to a CSV file.

Command-Line Input CLI is a command-line program that accepts text input to execute operating system functions.

Using Canvas CLI tool export data from PostgreSQL


Step 1:

Prerequisites:

Install Node.js


$ curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - sudo apt-get install -y nodejs



Step 2:

Install via npm


$ cd canvas/
$ git clone https://github.com/instructure/canvas-data-cli.git && cd canvas-data-cli
$ sudo apt install make
$ sudo make installLocal




Now, I already have the CLI tool.

Next step I can get data using CLI.


Step 3:

Configuring:


To generate a stub of this configuration


$ canvasDataCli sampleConfig
#Rename this to a file
$ cp config.js.sample config.js


#I need to change it every time.
#Cause IP address is different. 
#Change apiURL
$ vim config.js


apiUrl change to:

apiUrl: 'http://<public ip adress>/api'


Change key

Call API

This method to no avail

A small CLI tool for syncing data from the Canvas Data API.


 
 
 

Comments


©2021 by Suzie Ji. Proudly created with Wix.

bottom of page