Automação da Atualização dos dados

From TaticView
Revision as of 17:26, 18 October 2016 by Luiz (talk | contribs) (Created page with "Você pode através dess processo automatizar importações dos seus Arquivos de Dados.")
Jump to: navigation, search

Automação de importações de dados no TaticView

Você pode através dess processo automatizar importações dos seus Arquivos de Dados.

Some setup procedures and the use of TVcli command line program are necessary to automate imports on TavicView.

If you are having trouble, open a support ticket on https://support.taticview.com/open.php. We are glad to help you.

Installing TVcli

First download the installer:

  • +Windows+
  • +Linux+
  • +Mac-OS+

Then run the installation on the same workstation where the files that are going to be automatically imported are.


ACCESS TOKEN generation

You must have an ACCESS TOKEN registered on TaticView and TVcli before you can run an automation import. An ACCESS TOKEN is always related with a TaticView user. The ACCESS TOKEN is like a password generated by TaticView which allows access to your account through TVCli. It can be revoked by you at any time, allowing you to decide who and when can access your account on TaticView.

You can generate the ACCESS TOKEN in two ways:


Through TVcli

  1. Run the command through command line requesting the generation of a new ACCESS TOKEN.
 Syntax: tvcli -cmd get_token_by_password -user <user name> -password <user password> [-token_name "<token name>"]
 -cmd                   - get_token_by_password - Requests and stores the ACCESS TOKEN through command line. (TVcli)
 -user                  - TaticView user
 -password              - TaticView password
 -token_name (optional) - The name that you want to give to the access token. Default name "TaticView CLI"          
 Example: tvcli -cmd get_token_by_password -user myemail@email.com -password 123466 -token_name "TVcli Server 1"


Through TacticView interface

  1. Identify yourself on TaticView and access the My account button ACCESS TOKENS;
  2. On !identificacao-novo-token.png! enter a name to identify the ACCESS TOKEN on the list and then click on Generate new TOKEN.
  3. An ACCESS TOKEN will be generated !generated-token.png!
  4. Run TVcli informing the generated ACCESS TOKEN
 Syntax: tvcli -cmd store_token -user <user name> -token <generated token>
 -cmd   - store_token - stores token generated through the interface
 -user  - TaticView user 
 -token - The token generated through the interface
 Example: tvcli -cmd store_token -user meuemail@email.com -token 9bdr845gh5r4r1vd5d5


Importing in an automated way

You can only automate the import of data files that have been already created on TaticView, so you are going to need at least one manual import to create the necessary structure. Then you must grant the automatic import to the desired data file.. To do this click on the imported file (On the TaticView interface), select Properties, and check the checkbox Automatic Importation, which displays the identifier code of your data file, as you can see in the example below:

!datamart-dropdown.png!


!automatic-importation.png!.

Once the data file is imported, granted for automatic import and you have your identification code, you can run the import through the command line.

 Syntax: tvcli -cmd import_file -user <user name> -datamart <identifier> -file "<file/spreadsheet>" [-type <type>] [-wait] [-noerror] -[notifyshare]
 -cmd                   - import_file   - uploads the data file and places it in the import queue
 -user                  - TaticView user 
 -datamart              - identifier of the data file obtained in the Data file properties at the interface.
 -file                  - Text data file (CSV) or spreadsheet (XLSX,XLS) to be imported.
 -type (opcional)       - clear_and_add - Deletes all data from TaticView Data File and imports the new data. (default)
                          append        - Adds the new data at the end of the TaticView Data File. It is necessary to be careful not to duplicate any data.
 -wait (opcional)       - waits for the end of the import.  It is needed to test Output Status
 -noerror (opcional)    - does not notify the user if an error occurs during the process
 -notifyshare (opcinal) - sends data update notification to users who have these data file dashboards shared when the importing process ends without errors.
 Example:
 tvcli -cmd import_file -user myemail@email.com -datamart 246 -file "c:\taticview\imp\spreadsheet.xlsx"
 tvcli -cmd import_file -user myemail@email.com -datamart 246 -file "c:\taticview\imp\file.csv" -notifyshare
 tvcli -cmd import_file -user myemail@email.com -datamart 246 -file "c:\taticview\imp\spreadsheet.xlsx" -wait
 tvcli -cmd import_file -user myemail@email.com -datamart 246 -file "c:\taticview\imp\spreadsheet.xlsx" -type clear_and_add
 tvcli -cmd import_file -user myemail@email.com -datamart 246 -file "c:\taticview\imp\spreadsheet.xlsx" -type append
 tvcli -cmd import_file -user myemail@email.com -datamart 246 -file "c:\taticview\imp\spreadsheet.xlsx" -type append -noerror


Command return test

The TVCI executable returns different codes to report the success or failure during the execution process.

 0 - Success
 8 - Error

A notification is sent to the user if an error occurs during the import process. A log with the imports details is generated in the logs directory, below the directory where TVcli was installed.

An example of Windows running script:

 tvcli -cmd import_file -user meuemail@email.com -datamart 246 -file "c:\taticview\imp\planilha.xlsx" -notifyshare
 if errorlevel <> 0
   Error notification by email
 fi


Important

The free version grants you automation import from only one data source. You need to configure the feature "*automatic data update*" in your subscription to automate the imports of more data sources.