modzyClient.submitJobJDBC

Submits a job using JDCB parameters as inputs

submitJobJDBC(modelId, versionId, url, username, password, driver, query, explain=false)

Submit a job based on a sql query on a database accessed through JDBC.

Parameters

modelId

string

Model identifier provided by Modzy or a model object previusly loaded.

'ed542963de'

versionId

string

The model’s version number. It follows the semantic versioning format.

'1.0.1'

url

string

JDBC url to connect to the database

'jdbc:postgresql://database-host:5432/mydatabase'

username

string

The username to access the database

'username'

password

string

The password to access the database

'password'

driver

string

Full driver class name

'org.posgresql.Driver'

query

string

The query to execute, notice that we will try to match the column names to the model input keys, so you'll need to use alias for that.

'select description as \'input.txt\' from my-table'

explain

boolean

If the model supports explainability, flag this job to return an explanation of the predictions

True

Returns

A Job object with the status from the server

{
    "$schema": "http://json-schema.org/draft-06/schema#",
    "$ref": "#/definitions/Job",
    "definitions": {
        "Job": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "model": {
                    "$ref": "#/definitions/Model"
                },
                "status": {
                    "type": "string"
                },
                "totalInputs": {
                    "type": "integer"
                },
                "jobIdentifier": {
                    "type": "string",
                    "format": "uuid"
                },
                "accessKey": {
                    "type": "string"
                },
                "explain": {
                    "type": "boolean"
                },
                "jobType": {
                    "type": "string"
                },
                "accountIdentifier": {
                    "type": "string"
                },
                "team": {
                    "$ref": "#/definitions/Team"
                },
                "user": {
                    "$ref": "#/definitions/User"
                },
                "jobInputs": {
                    "$ref": "#/definitions/JobInputs"
                },
                "submittedAt": {
                    "type": "string",
                    "format": "date-time"
                },
                "imageClassificationModel": {
                    "type": "boolean"
                }
            },
            "required": [
                "accessKey",
                "accountIdentifier",
                "explain",
                "imageClassificationModel",
                "jobIdentifier",
                "jobInputs",
                "jobType",
                "model",
                "status",
                "submittedAt",
                "team",
                "totalInputs",
                "user"
            ]            
        },
        "JobInputs": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "identifier": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            },
            "required": [
                "identifier"
            ]            
        },
        "Model": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "identifier": {
                    "type": "string"
                },
                "version": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                }
            },
            "required": [
                "identifier",
                "name",
                "version"
            ]            
        },
        "Team": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "identifier": {
                    "type": "string"
                }
            },
            "required": [
                "identifier"
            ]            
        },
        "User": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "identifier": {
                    "type": "string",
                    "format": "uuid"
                },
                "firstName": {
                    "type": "string"
                },
                "lastName": {
                    "type": "string"
                },
                "email": {
                    "type": "string"
                }
            },
            "required": [
                "email",
                "firstName",
                "identifier",
                "lastName"
            ]            
        }
    }
}

Examples

job = await modzyClient.submitJobEmbedded('ed542963de', '0.0.27', 'jdbc:postgresql://database-host:5432/mydatabase', 'username', 'password', 'org.posgresql.Driver', 'select description as \'input.txt\' from my-table');
console.log( `Job ${job.identifier} status ${job.status}` );

Using promises

modzyClient.submitJobEmbedded('ed542963de', '0.0.27', 'jdbc:postgresql://database-host:5432/mydatabase', 'username', 'password', 'org.posgresql.Driver', 'select description as \'input.txt\' from my-table', true)
  .then(
    (job)=>{
      console.log( `Job ${job.identifier} status ${job.status}` );
    }
  )
  .catch(
    (error)=>{
      console.error(error);
    }
  );

Did this page help you?