This page gives a Java code example to embed the SQLFlow-Ingester in your Java programme.
//1.import the following Ingester library importcom.gudu.sqlflow.ingester.exporter.SqlflowExporter;importcom.gudu.sqlflow.ingester.library.domain.DataSource;importcom.gudu.sqlflow.ingester.library.domain.DbVendor;importcom.gudu.sqlflow.ingester.library.domain.sqlflow.SQLFlow;importcom.gudu.sqlflow.ingester.library.result.Result;//2.Give the database parameters before invoking the IngesterDataSource source =newDataSource();//database host name (ip address or domain name) source.setHostname("localhost");//portsource.setPort("3306");//database namesource.setDatabase("test");//user namersource.setAccount("root");//database passwordsource.setPassword("123456");//Database type and version number, Check "List of Supported dbVerdors" section for a full list of the supported databases.//The second parameter can be null if no specific version need to be providedDbVendor dbVendor =newDbVendor("dbvmysql","5.7");source.setDbVendor(dbVendor);//Export the metadata, the result can be in object/json string.SqlflowExporter exec =newSqlflowExporter();//Take the result in SQLFLow objectResult<SQLFlow> result1 =exec.exporterMetadata(source);//Take the result in json stringResult<String> result2 =exec.exporterMetadataString(source);
For Snowflake users, you can refer to the following code sample if wish to use private key RSA for the connection: