This is a tool to synchronize and load Canvas Data into a database. It is written with the Laravel framework.
Pre Reqs This is based on Laravel 5.2, so you'll need to install the pre-requisites.
- PHP >= 5.5.9
- OpenSSL PHP Extension
- PDO PHP Extension
- Mbstring PHP Extension
- Tokenizer PHP Extension
Composer needs to be installed.
To install globally, use the following snippet.
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Clone
git clone https://github.com/HutchCC/CanvasData.git
Composer
cd CanvasData
composer install
Configuration
- Copy the .env.example file to .env
cp .env.example .env
- Edit .env file
nano .env
- Change the following lines to match your environment
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=Canvas_Data
DB_USERNAME=username
DB_PASSWORD=password
# Use the Key & Secret provided by Canvas Data
API_KEY=
API_SECRET=
API_BASEURL=https://portal.inshosteddata.com
- Generate unique artisan key for Laravel
php artisan key:generate
- Set permissions
chmod -R 777 bootstrap/cache
chmod -R 777 storage
- Create Database schema
- If you have an existing schema, it is best to drop it and re-create it so that it gets the correct collation & character set.
- All that's been tested is MySQl
utf8mb4 - default collation
- Be sure to name the schema the same as what is specified in the .env file for
DB_DATABASE=Canvas_Data
CREATE SCHEMA `Canvas_Data` DEFAULT CHARACTER SET utf8mb4 ;
- Sync all of the canvas data files for your account. This can take several hours for the first sync.
php artisan canvasdata:sync
- Unpack the gzipped files into a single txt file per table.
- Default all
php artisan canvasdata:unpack [ all | table(s) ]
- The requests table is typically very large, so if you don't need or want that table you can pass a single table or an array of tables separated by commas.
- e.g.
php artisan canvasdata:unpack account_dim,assignment_dim,assignment_fact
- Create_Schema The columns and data sets change from time to time, this command drops and then rebuilds the tables.
- Note: this will drop the tables so that they can be re-created. The philsophsy behind this is that the Canvas Data is the authoritative source.
php artisan canvasdata:create_schema
- Load_Tables Pass the tables you want loaded separated by commas. Specify all to load all of the tables.
- Default all
php artisan canvasdata:load_table [ all | table(s) ]