Canvas Data Utilities Documentation

Similar documents
olapy Documentation Release Abilian SAS

PyZabbixObj Documentation

MySQL Installation Guide (Windows)

turbo-hipster Documentation

MySQL Installation Guide (OS X)

IceWarp to IceWarp Migration Guide

MySQL Installation Guide (Windows)

Set of python scripts to work with GnuCash books Documentation

Traffic violations revisited

Pusher Documentation. Release. Top Free Games

Crate Shell. Release

Alarm Counter. A Ceilometer OpenStack Application

agate-sql Documentation

Watson - DB. Release 2.7.0

BanzaiDB Documentation

nidm Documentation Release 1.0 NIDASH Working Group

SQLite vs. MongoDB for Big Data

Archan. Release 2.0.1

databuild Documentation

Installing PostgreSQL on Windows Server 2003

INTRODUCTION TO DATABASES IN PYTHON. Creating Databases and Tables

1 INTRODUCTION TO EASIK 2 TABLE OF CONTENTS

hmda_tools Documentation

DB Export/Import/Generate data tool

Enterprise Reporting -- APEX

REST API Operations. 8.0 Release. 12/1/2015 Version 8.0.0

Mysql Query Browser Export Table Structure

ExtraHop 7.3 ExtraHop Trace REST API Guide

Manual Speedy Report. Copyright 2013 Im Softly. All rights reserved.

barge In option 127 bigdecimal variables 16 biginteger variables 16 boolean variables 15 business hours step 100

Installing the EasyLobby / WinDSX Integration

Using the Scripting Interface

Torndb Release 0.3 Aug 30, 2017

Product: DQ Order Manager Release Notes

TangeloHub Documentation

Pypeline Documentation

I hate money. Release 1.0

scrapekit Documentation

Technical Reference Manual

Introduction to pysqlite

Mastering phpmyadmiri 3.4 for

Aquaforest CheckPoint Reference Guide

Dynamically build connection objects for Microsoft Access databases in SQL Server Integration Services SSIS

edeposit.amqp.antivirus Release 1.0.1

requests-cache Documentation

MySQL On Crux Part II The GUI Client

Documentation Accessibility. Access to Oracle Support. Supported Browsers

TUTORIAL FOR IMPORTING OTTAWA FIRE HYDRANT PARKING VIOLATION DATA INTO MYSQL

ers Documentation Release 0.13 ers-devs

Exploring the Microsoft Access User Interface and Exploring Navicat and Sequel Pro, and refer to chapter 5 of The Data Journalist.

Django-Select2 Documentation. Nirupam Biswas

How to Recover a Primavera P6 Password

Connect Databases to AutoCAD with dbconnect Nate Bartley Test Development Engineer autodesk, inc.

NCSS: Databases and SQL

Marathon Documentation

pyautocad Documentation

Python Working with files. May 4, 2017

Nimsoft options for routing messages (QoS/Alarms) between hubs

PVRC Internet Assignment & Duties

Copy Data From One Schema To Another In Sql Developer

Moodle Destroyer Tools Documentation

RiotWatcher Documentation

IPython Cypher Documentation

Sql Server 2005 Change Schema For All Tables

Mobile Forms Integrator

Motivation: Qgis: Database:

sqlitebiter Documentation

Custom Report Builder Installation Instruction and User Guide February 2010

origin destination duration New York London 415 Shanghai Paris 760 Istanbul Tokyo 700 New York Paris 435 Moscow Paris 245 Lima New York 455

PowerShield SNMP Adaptor

[301] JSON. Tyler Caraza-Harter

pykafka Release dev.2

Automatically Generate Xml Schema From Sql Server Tables

PART I SQLAlchemy Core

Kiki Documentation. Release 0.7a1. Stephen Burrows

SQL Functionality SQL. Creating Relation Schemas. Creating Relation Schemas

White Paper. Export of Fabasoft Folio Objects to a Relational Database. Fabasoft Folio 2017 R1 Update Rollup 1

Orchestrating Big Data Solutions with Azure Data Factory

Pulp Python Support Documentation

prompt Documentation Release Stefan Fischer

More Skills 11 Export Queries to Other File Formats

DOCUMENT REVISION HISTORY

The main differences with other open source reporting solutions such as JasperReports or mondrian are:

Notices. Test rules. Page 1 of 8. CS 1112 Spring 2018 Test 2

Privacy and Security in Online Social Networks Department of Computer Science and Engineering Indian Institute of Technology, Madras

Oracle Sql Describe Schemas Query To Find Database

NoSQL Databases An efficient way to store and query heterogeneous astronomical data in DACE. Nicolas Buchschacher - University of Geneva - ADASS 2018

WIRELESS DATABASE VIEWER PLUS (ENTERPRISE EDITION) SERVER SIDE USER GUIDE

Workspace Administrator Help File

izzati Documentation Release Gustav Hansen

ameh Documentation Release Eric Pierce

From MySQL to PostgreSQL

Software Release Notes for XSS AD/SQL version 5.1.3

Migration from Metalogix Archive Manager (MAM) to Enterprise Vault (EV)

DOCUMENT REVISION HISTORY

Let Robots Manage Your Schema Without Killing All Humans. Jenni

MySQL: Access Via PHP

Pentaho Data Integration (PDI) Standards for Lookups, Joins, and Subroutines

Jaywalking in Traffic Safe Migrations at Scale. Brad Urani Staff Engineer

sqlalchemy-redshift Documentation

Transcription:

Canvas Data Utilities Documentation Release 0.0.1a Kajigga Dev Mar 07, 2017

Contents 1 CanvasData Utilities 3 1.1 Module Usage.............................................. 3 1.2 Config File................................................ 4 1.3 Command-line Tool........................................... 5 1.4 Usage................................................... 5 2 Using the module programatically 7 3 Indices and tables 9 Python Module Index 11 i

ii

Canvas Data Utilities Documentation, Release 0.0.1a Contents: Contents 1

Canvas Data Utilities Documentation, Release 0.0.1a 2 Contents

CHAPTER 1 CanvasData Utilities Full documentation This python module is designed to make it easy to access Canvas Data files. Currently, this module makes it possible to: Convert downloaded Canvas Data files to CSV files with headers export SQL table creation statements list files for a table download all files or files for a specific table view the Canvas Data schema (fields, field types, etc) connect to a database (uses sqlalchemy) to create tables, import data, run SQL queries Module Usage This module can be used programatically in other scripts and software. An example of creating a canvas_data object is found below.: from canvas_data_utils.canvas_data_auth import CanvasData canvas_data_object = CanvasData( API_KEY=YOUR_API_KEY, API_SECRET=YOUR_API_SECRET, base_folder = YOUR_BASE_DIR, data_folder = YOUR_DATA_DIR) Once you have that object created, you can... generate mysql table creation statements 3

Canvas Data Utilities Documentation, Release 0.0.1a mysql_table_creation_statement = canvas_data_object.table_creation_statement('mysql') generate sqlite table creation statements sqlite_table_creation_statement = canvas_data_object.table_creation_statement('sqlite ') generate postgres table creation statements postgres_table_creation_statement = canvas_data_object.table_creation_statement( 'postgres') create tables in a database given by a connection string canvas_data_object.create_tables('sqlite:///{}'.format(db_filename)) fetch the current schema (as json) schema = canvas_data_object.fetch_schema() get a list of columns in a table user_dim_columns = canvas_data_object.get_schema_columns( 'user_dim') convert an text file download from TSV (Tab Separated Values) to CSV canvas_data_object.convert_tsv_to_csv(tsv_filepath) list all the tables in the schema table_list = canvas_data_object.table_list() download and convert all files to CSV canvas_data_object.convert_all_to_csv() list all downloadable files for a table file_list = canvas_data_object.list_all_files('user_dim') Config File You need to create a config file somewhere. This config file is a typical.ini file. It should look something like the following example. [config] API_SECRET = replace_with_api_secret_from_canvas_data API_KEY = replace_with_api_key_from_canvas_data base_folder = /path/to/base/folder/for/downloads/ data_folder = %(base_folder)s/test2 connection_string = sqlite:///%(base_folder)s/sample.db 4 Chapter 1. CanvasData Utilities

Canvas Data Utilities Documentation, Release 0.0.1a Note: The connection_string configuration follows the connection pattern needed by SQLAlchemy at http://docs. sqlalchemy.org/en/rel_1_0/core/engines.html. This library supports any database type than SQLAlchemy does. Command-line Tool This library includes a command line utility called canvasdata. Usage canvasdata [-h] [--config CONFIG] [-t TABLE] [--offline OFFLINE] {convert_to_csv,import,create_tables,reset,sql_create_statement,list_ files,download,sample_queries,schema} optional arguments: -h, --help show this help message and exit --config CONFIG path to the configuration file -t TABLE specify a specific table --offline OFFLINE run in offline mode 1.3. Command-line Tool 5

Canvas Data Utilities Documentation, Release 0.0.1a 6 Chapter 1. CanvasData Utilities

CHAPTER 2 Using the module programatically class canvas_data_utils.canvas_data_auth.canvasdata(*args, **kwargs) Bases: object clear_table(schema_table) Delete all records from the table schema_table convert_all_to_csv() converts all files (downloading them first if necessary) to CSV create_tables(db_connect_string=none) creates all of the tables in the database download_all_files(table=none) Download all of the files for a given table or, if no table is specified, download all files for all tables. download_single_file(file_url, filename) Download a single file given the file_url and the filename to give the file. file_imported(filename) returns true if the file has been imported into the database. otherwise returns false get_latest_download(table) returns the latest downloaded file for a table import_all_requests() imports all requests files. requests files are incremental. To get a full picture of web traffic in a given time period, you must import the requests file individually import_data(schema_table=none, with_download=true) downloads and imports all tables unless schema_table is defined, in which case it only imports that table import_file(schema_table, csv_filename) imports the table specified by schema_table with the data from csv_filename. latest_files() returns the latest downloadable file for a table 7

Canvas Data Utilities Documentation, Release 0.0.1a list_all_files(schema_table) Lists all files for a table normalize_values_for_db(obj, schema_table) normalizes some of the data for the database. For example, many fields come across with N representing a null value. This method changes that to None so it imports correctly into the database. This method also ensures that floats are floats, integers are integers, date fields have proper dates or are blank, etc. remove_caches() removes all cached data (schema, imported_files, etc) from the base folder reset_database(db_connect_string=none) resets the database by dropping all known tables then recreating them. This method does _not_ import data. 8 Chapter 2. Using the module programatically

CHAPTER 3 Indices and tables genindex modindex search 9

Canvas Data Utilities Documentation, Release 0.0.1a 10 Chapter 3. Indices and tables

Python Module Index c canvas_data_utils, 5 11

Canvas Data Utilities Documentation, Release 0.0.1a 12 Python Module Index

Index C canvas_data_utils (module), 5 L latest_files() (canvas_data_utils.canvas_data_auth.canvasdata CanvasData (class in canvas_data_utils.canvas_data_auth), 7 list_all_files() (canvas_data_utils.canvas_data_auth.canvasdata clear_table() (canvas_data_utils.canvas_data_auth.canvasdata convert_all_to_csv() (canvas_data_utils.canvas_data_auth.canvasdata create_tables() (canvas_data_utils.canvas_data_auth.canvasdata D download_all_files() (canvas_data_utils.canvas_data_auth.canvasdata download_single_file() (canvas_data_utils.canvas_data_auth.canvasdata F file_imported() (canvas_data_utils.canvas_data_auth.canvasdata G get_latest_download() (canvas_data_utils.canvas_data_auth.canvasdata I import_all_requests() (canvas_data_utils.canvas_data_auth.canvasdata import_data() (canvas_data_utils.canvas_data_auth.canvasdata import_file() (canvas_data_utils.canvas_data_auth.canvasdata N normalize_values_for_db() (canvas_data_utils.canvas_data_auth.canvasdata method), 8 R remove_caches() (canvas_data_utils.canvas_data_auth.canvasdata method), 8 reset_database() (canvas_data_utils.canvas_data_auth.canvasdata method), 8 13