sqlflow_public/api/csharp/readme.md

4.4 KiB

Get Started

Download the executable program according to your operating system.

Configuration

SQLFlow Cloud server

Create a file named config.json in directory where the executable(.exe) exists, and then input your SecretKey and UserId, always set host to https://api.gudusoft.com ,for example:

{
  "Host": "https://api.gudusoft.com",
  "SecretKey": "XXX",
  "UserId": "XXX"
}

If you want to connect to the SQLFlow Cloud Server, you may request a 30 days premium account to get the necessary userId and secret code.

SQLFlow on-premise version

Create a file named config.json in directory where the executable(.exe) exists, and always set userId to gudu|0123456789, keep userSecret empty, and set hostto your server ip, for example:

{
  "Host": "http://your server ip:8081",
  "SecretKey": "",
  "UserId": "gudu|0123456789"
}

Please check here to see how to install SQLFlow on-premise version on you own server.

Set permissions

For mac:

chmod +x SQLFlowClient

For linux:

chmod +x SQLFlowClient

Create a simple sql file for testing

For example, test.sql:

insert into t2 select * from t1;

Run the program from command line:

./SQLFlowClient test.sql
./SQLFlowClient test.sql -g

Usage

SQLFlowClient filepath -parameter value

parameters

parameter short value type default
--graph -g boolean false Get the graph from sql.
--dbvendor -v one of the following list :
bigquery, couchbase, db2, greenplum,
hana , hive, impala , informix,
mdx, mysql, netezza, openedge,
oracle, postgresql, redshift, snowflake,
mssql, sybase, teradata, vertica
oracle Set the database of the sqlfile.
--showRelationType -r one or more from the following list :
fdd, fdr, frd, fddi, join
fdd Set the relation type.
--simpleOutput -s boolean false Set whether to get simple output.
--ignoreRecordSet boolean false Set whether to ignore record set.
--ignoreFunction boolean false Set whether to ignore function.
--output -o string "" Save output as a file.
--help Display this help screen.
--version Display version information.

examples

  1. SQLFlowClient test.sql
  2. SQLFlowClient test.sql -g
  3. SQLFlowClient test.sql -g -v oracle
  4. SQLFlowClient test.sql -g -v oracle -r fdr
  5. SQLFlowClient test.sql -g -v oracle -r fdr,join
  6. SQLFlowClient test.sql -g -v oracle -r fdr,join -s
  7. SQLFlowClient test.sql -g -v oracle -r fdr,join -s --ignoreRecordSet
  8. SQLFlowClient test.sql -g -v oracle -r fdr,join -s --ignoreFunction -o result.txt

Compile and build on windows

Download and install the .NET Core SDK

https://dotnet.microsoft.com/download

Download source code

git clone https://github.com/sqlparser/sqlflow_public.git

Build from command line

dotnet publish -c Release /p:PublishProfile=Properties\PublishProfiles\linux.pubxml
dotnet publish -c Release /p:PublishProfile=Properties\PublishProfiles\osx.pubxml
dotnet publish -c Release /p:PublishProfile=Properties\PublishProfiles\win.pubxml

Download executable programs