Package: faas-cli
FaaS-CLICommand Line Interface (CLI) for FaaS APIhttps://api.sonra.io/documentation/UsageHelpTo get a general help with usage examples usefaascli--helpTo get a help for a specific command usefaasclisource_data--help
faasclisource_schema--help
faasclitarget_connection--help
faascliconversion--help
faascliwebhook--helpLoginTo login into FaaS using credentials provided bySonrause# for interactive email/passwordfaasclilogin# for predefined emailfaasclilogin--usernameemail@domain.com# for predefined email/passwordfaasclilogin--usernameemail@domain.com--password"mypassword"Source data/schemaSource Data is the data that you feed to FaaS for conversion. XML and JSON are currently supported.The Source Schema is metadata for your Source Sata. It defines data types, relationships, constraints etc. XML schema (XSD) is currently the only supported Source Schema.Once authenticated, you can create Source Data/Schema by the following commands:faascli source_data create file --name <name> --type <xml|json> --file <path_to_file>faascli source_schema create file --name <name> --file <path_to_file>Examples:xml data# xml source data from local file systemfaasclisource_datacreatefile--namecustomers_data1--typexml--file~/data/CustomersOrders.xml# for multiple files under a single name use --file multiple timesfaasclisource_datacreatefile--namecustomers_data1--typexml--file~/data/CustomersOrders_11112019.xml--file~/data/CustomersOrders_12112019.xmljson datafaasclisource_datacreatefile--nameweather_11112019--typejson--file~/data/weather.jsonxsd schemafaasclisource_schemacreatefile--namecustomers_schema--file~/data/customersorders.xsdTarget connectionsTarget Connection is a resource containing connection details for thedata storage, where you want to save the processed data.Note, that Target Connection is an optional resource. If you don't create Target Connection, you still can process data, and the output will be saved in our cloud and will be available for download.Different connections require different input parameters, for more details about creating connections use the following commands to get a help/usage messages:# Amazon S3:faasclitarget_connectioncreates3--help# MySQL:faasclitarget_connectioncreatemysql--help# PostGreSQL:faasclitarget_connectioncreatepostgresql--help# Snowflake:faasclitarget_connectioncreatesnowflake--help# Microsoft SQL Server:faasclitarget_connectioncreatesqlserver--help# Oracle DB:faasclitarget_connectioncreateoracle--help# Amazon Redshift:faasclitarget_connectioncreateredshift--helpConversionsConversion is a task of processing of Source Data, using a Source Schema (optionally), and saving the result to a Target ConnectionTo create a conversion use the following commands:faascliconversioncreate--name<unique_name>--data<source_data_name>[--schema<schema_name>]--target<target_connection_name>Examples# to process XML without XSD to downloadable resultsfaascliconversioncreate--nametestconv--datacustomers_data1--targetdownload_link# to process XML with XSD to downloadable resultsfaascliconversioncreate--nametestconv--datacustomers_data1--schemacustomers_schema--targetdownload_linkIfdownload_linkis selected, results will be available right after conversion is completed.
You can track conversion's status by calling:faascliconversionget--nametestconv{"create_date":"2019-11-11T14:14:57.007+0000","credit_usage":null,"data_source_connection":{"create_date":"2019-11-06T10:05:00.806+0000","name":"testurl2","path":"https://clinicaltrials.gov/ct2/download_studies?lupd_s=11%2F11%2F2018&lupd_e=11%2F12%2F2018","size":0,"source_type":"http","type":"xml"},"diagram_link":null,"download_link":null,"full_status":"SCHEDULED","mapping_link":null,"name":"testconv","schema_source_connection":null,"status":"S","target_connection":null}The fieldfull_statusindicates the status of the conversion. Once the status isCOMPLETED, the link to results will be available in thedownload_linkfield of the response.
Each conversion also generates mapping or lineage (mapping_link) and ER Diagram (diagram_link).{"create_date":"2019-11-11T14:14:57.007+0000","credit_usage":6,"data_source_connection":{"create_date":"2019-11-06T10:05:00.806+0000","name":"testurl2","path":"https://clinicaltrials.gov/ct2/download_studies?lupd_s=11%2F11%2F2018&lupd_e=11%2F12%2F2018","size":0,"source_type":"http","type":"xml"},"diagram_link":"https://sonra-api.s3-eu-west-1.amazonaws.com/o...","download_link":"https://sonra-api.s3.amazonaws.com/o...","full_status":"COMPLETED","mapping_link":"https://sonra-api.s3-eu-west-1.amazonaws.com/o...","name":"testconv","schema_source_connection":null,"status":"C","target_connection":null}