{"id":21269000,"url":"https://github.com/qubole/qds-sdk-java","last_synced_at":"2025-07-11T05:30:45.956Z","repository":{"id":15608118,"uuid":"18344410","full_name":"qubole/qds-sdk-java","owner":"qubole","description":"A Java library that provides the tools you need to authenticate with, and use the Qubole Data Service API.","archived":false,"fork":false,"pushed_at":"2022-11-16T00:54:47.000Z","size":22370,"stargazers_count":7,"open_issues_count":12,"forks_count":45,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-04-17T22:49:33.274Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://api.qubole.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qubole.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-01T20:49:52.000Z","updated_at":"2024-04-17T22:49:33.275Z","dependencies_parsed_at":"2023-01-11T20:23:39.968Z","dependency_job_id":null,"html_url":"https://github.com/qubole/qds-sdk-java","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qubole%2Fqds-sdk-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qubole%2Fqds-sdk-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qubole%2Fqds-sdk-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qubole%2Fqds-sdk-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qubole","download_url":"https://codeload.github.com/qubole/qds-sdk-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225693821,"owners_count":17509227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-21T08:07:00.461Z","updated_at":"2024-11-21T08:07:01.191Z","avatar_url":"https://github.com/qubole.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Qubole Data Service Java SDK\nA Java library that provides the tools you need to authenticate with, and use the Qubole Data Service API.\n\n## Installation\nThe SDK is available in The Central Repository. To use the SDK, add the following dependency to your Java application.\n\n```\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.qubole.qds-sdk-java\u003c/groupId\u003e\n    \u003cartifactId\u003eqds-sdk-java\u003c/artifactId\u003e\n    \u003cversion\u003e1.3.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nNOTE: see the bullet below regarding Jersery 2.0\n\n### JDK 11 Build\n\nBy default the library is built with the `jdk8`, but if you need a `jdk11` version, run the command:\n\n```\nmvn clean install -P jdk11-compliant\n```\n\n## Usage\n\n\nIn your application initialization code, allocate a QdsClient object:\n\n```\nQdsConfiguration configuration = new DefaultQdsConfiguration(YOUR_API_KEY);\nQdsClient client = QdsClientFactory.newClient(configuration);\n```\nYOUR_API_KEY referenced in above code is a placeholder for Qubole API Token. Please refer to following documentation for  further details on how to obtain them: http://docs.qubole.com/en/latest/rest-api/api_overview.html#authentication\n\nThen, make api calls as needed. E.g.\n\n```\nFuture\u003cCommandResponse\u003e hiveCommandResponseFuture = client\n    .command()\n    .hive()\n    .query(\"show tables;\")\n    .invoke();\nCommandResponse hiveCommandResponse = hiveCommandResponseFuture.get();\n...\n```\n\nAlternatively, you can use Jersey's callback mechanism. E.g.\n\n```\nInvocationCallback\u003cCommandResponse\u003e callback = new InvocationCallback\u003cCommandResponse\u003e()\n{\n    @Override\n    public void completed(CommandResponse clusterItems)\n    {\n        // ...\n    }\n\n    @Override\n    public void failed(Throwable throwable)\n    {\n        // ...\n    }\n};\nclient.command()\n    .hive()\n    .query(\"show tables;\")\n    .withCallback(callback)\n    .invoke();\n...\n```\n\nAs part of your application's shutdown, close the client:\n\n```\nclient.close();\n```\n\n## Waiting for Results\n\nImportant: when you submit a command/query, it can take time for it to execute. You cannot get the result until it is ready.\nA utility is provided that polls the command and waits for the results: ResultLatch. You can use it to block in the foreground\nor using a callback.\n\nBlocking:\n```\nResultLatch latch = new ResultLatch(client, queryId);\nResultValue = latch.awaitResult();\n```\n\nWith callback:\n```\nResultLatch.Callback callback = new ResultLatch.Callback()\n{\n    @Override\n    public void result(String queryId, ResultValue resultValue)\n    {\n        // use results\n    }\n\n    @Override\n    public void error(String queryId, Exception e)\n    {\n        // handle error\n    }\n};\nResultLatch latch = new ResultLatch(client, queryId);\nlatch.callback(callback);\n```\n\n## Streaming Results\n\nSome Qubole APIs write large result sets to S3. If you would like to stream those results, use ResultStreamer.\nE.g.\n\n```\nResultStreamer streamer = new ResultStreamer(client);  // save this until the end of your application\n\n...\n\nFuture\u003cResultValue\u003e results = client.command().results(id)...invoke();\nReader in = streamer.getResults(results.get());\n```\n\nAs part of your application's shutdown, close the client:\n\n```\nstreamer.close();\n```\n\n## Paging\n\nSome of the APIs support paging. These APIs have the \"forPage\" method. E.g.\n\n```\n// return page 2 using 3 per page\nclient.command().history().forPage(2, 3).invoke();\n```\n\n## APIs\n\nUsing the QdsClient, you can access any of the Qubole APIs:\n\n| API | Example |\n| --- | ------- |\n| [Reports](http://www.qubole.com/documentation/en/latest/rest-api/reports_api/index.html) | client.report().allCommandsReport().start_date(...).end_date(...).limit(...).invoke(); |\n| [Scheduler](http://www.qubole.com/documentation/en/latest/rest-api/scheduler_api/index.html) | client.scheduler().list().invoke(); |\n| [DbTaps](http://www.qubole.com/documentation/en/latest/rest-api/dbtap_api/index.html) | client.dbTaps().list().invoke(); |\n| [Hive Metadata](http://www.qubole.com/documentation/en/latest/rest-api/hive_metadata_api/index.html) | client.hiveMetadata().getTableProperties(\"table\").invoke(); |\n| [Cluster](http://www.qubole.com/documentation/en/latest/rest-api/cluster_api/index.html) | client.cluster().list().invoke(); |\n| [Command](http://www.qubole.com/documentation/en/latest/rest-api/command_api/index.html) | client.command().history().invoke(); |\n\n## Jersey 2.0\n\nThe SDK uses Jersey 2.0. Some widely used open source libraries such as Dropwizard are incompatible with Jersey 2.0.\nTo workaround this incompatiblity, you can build the SDK using the Maven shade plugin which will hide the SDK's usage\nof Jersey 2.0. To build a shaded version of the SDK, follow these steps:\n\n* Download the SDK. Either:\n * Clone the project: `git clone git@github.com:qubole/qds-sdk-java.git`\n * Or download one of the releases from https://github.com/qubole/qds-sdk-java/releases\n* cd to the directory\n* `mvn -P shaded install`\n\n## Javadoc\n\nhttps://qubole.github.io/qds-sdk-java/apidocs/latest/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqubole%2Fqds-sdk-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqubole%2Fqds-sdk-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqubole%2Fqds-sdk-java/lists"}