Граф коммитов

155 Коммитов

Автор SHA1 Сообщение Дата
Yihezkel Schoenbrun 438ec1397f
Quickstart Application (#195)
* Initial commit.
The intent is to review this in its current feature-complete state, so I can also commit the equivalent changes in the Python SDK.
Then, in the next PR (or before merging this PR), I will make some additional improvements as discussed, including break main into individual methods and refactor this "query-ingest-query" approach into an additional "query-only" mode.

* Remove comment

* Optimize if/else

* Minor verbiage changes

* Minor verbiage changes

* Minor verbiage changes

* Update README.md

Co-authored-by: Yochai Gilad <yogilad@microsoft.com>

* - Break main up into methods
- Consider new parameters
- Few code review changes, like consistent periods at end of sentences and filename consistency with Python

* Only alter batching policy if !useExistingTable

* - Pass filesize of 0 for autodetection
- Do not create a File object to get its path; just pass along the provided path
- Move alterBatchingPolicy to within createNewTable, and wrap it in if(false) so it won't run
- Add comment explaining that we generally wouldn't print the output of a control command

* - Improve README text
- Change .alter command to .alter-merge command

* - Change filename kusto-sample-config.json to kusto_sample_config.json to be consistent with Python

* - Fix reference to Python
- Aad a comment for AppCertificate auth

Co-authored-by: Yochai Gilad <yogilad@microsoft.com>
2021-12-05 10:39:22 +02:00
AsafMah d43492caff
Added sstream type (#193) 2021-12-05 10:15:46 +02:00
AsafMah afb1ad8142
Updated surefire version to make tests run (#197)
Breaking Changes:

Reverted mandatory DataFormat
Features:

Added github actions for running builds
Fixes:

Fixed pipeline to run and test
Fixed failing tests and other minor fixes
2021-12-05 09:50:49 +02:00
Yihezkel Schoenbrun c37107754d
Support AAD Managed Identity authentication (#194)
* Support AAD Managed Identity authentication

* Update data/src/main/java/com/microsoft/azure/kusto/data/auth/ManagedIdentityTokenProvider.java

Co-authored-by: AsafMah <asafmahlev@microsoft.com>

* Fix scope

* Fix space

* Downgrade azure-identity package to avoid showstopper bug causing ManagedIdentity auth to fail.

Note that there still remains 1 change to be made in this PR - to set the scope based on the Kusto Service Resource ID from CloudInfo. In support of this, I have a 22-file change to broadly improve how the TokenProviders consume from CloudInfo, but am hesitating to push that before understanding the initial CloudInfo design decisions.

At a high level, I would like to change the throws list when creating a client. It currently throws URISyntaxException, because it only uses CloudInfo when a token is requested. However, I don't see why we don't make use of CloudInfo when creating the client, in which case we should return a DataClientException/DataServiceException. This is a breaking change and a non-trivial paradigm shift, so it's worth discussing first.

I will begin discussing this with Asaf tomorrow.

* Resolve dependency conflicts

* Reorganize CloudInfo code

* Fix compilatino error

* Remove superfluous method (determineAadAuthorityUrl)

* Remove duplicate line

* Fix cloudinfo initialization

* Fix E2E tests (have been broken for a while)

* Switch order of clientUrl to be first

Co-authored-by: AsafMah <asafmahlev@microsoft.com>
2021-11-25 08:31:52 +02:00
Yihezkel Schoenbrun b0589700e3
Add to main README link to .NET's best practices guide (#192) 2021-11-01 09:50:34 +02:00
ohad bitton 7309936724
Fix closeable order (#190)
Co-authored-by: Ohad Bitton <ohbitton@microsoft.com>
2021-10-24 15:26:09 +03:00
ohad bitton 0a2e3c63d1
v3.0.0 (#187) 2021-10-17 11:43:01 +03:00
ohad bitton 674045bfb9
Fix time out as timestamp (#185)
* fix timeout

* revert

* timeout as timespan

* j

* many changes

* better

* clean

* clean

* no auth

* better

* better

* comments

* comments

* comments

Co-authored-by: KustoIbizaExtension Build <kustodev@microsoft.com>
Co-authored-by: Ohad Bitton <ohbitton@microsoft.com>
2021-10-15 13:39:28 +03:00
Yihezkel Schoenbrun cde2361654
Implement MSAL Subject Name Issuer authentication (#165)
* Implement MSAL Subject Name Issuer authentication

* Update ConnectionStringBuilder.java

* Update ConnectionStringBuilder.java

* Fix build failure after OnCloudInit() was added to abstract parent

* Ensure we send the public certificate when using SNI

Co-authored-by: ohad bitton <32278684+ohadbitt@users.noreply.github.com>
2021-08-23 15:37:56 +03:00
Yihezkel Schoenbrun c905a4261d
Minor fixes, including enum naming convention (DATA_FORMAT to DataFormat) (#183) 2021-08-23 15:30:28 +03:00
Yihezkel Schoenbrun 69aa7e3ca4
Add x-ms-activitycontext and x-ms-user-id headers (#181)
* Add x-ms-activitycontext and x-ms-user-id headers

* Protect better against empty ClientRequestId

* Revert KustoDataExceptionBase to be abstract
2021-08-23 14:08:53 +03:00
ohad bitton 48ba143e24
Remove resultSet (#180)
* remove resultSet

* nit

* nit

* getAdditionalProperties

* nit

Co-authored-by: KustoIbizaExtension Build <kustodev@microsoft.com>
2021-07-13 17:46:29 +03:00
ohad bitton d6075a252e
Update pom.xml 2021-07-04 16:17:55 +03:00
KustoIbizaExtension Build 2ba8a75629 Merge remote-tracking branch 'origin/master' 2021-07-04 15:55:37 +03:00
KustoIbizaExtension Build 5d57fae87a Ingestion status 2021-07-04 15:27:43 +03:00
AsafMah d5de3419b6
Made url join more robust (#179) 2021-07-01 18:03:39 +03:00
AsafMah e2bbcd11d2
Bump to 2.8.0 2021-06-30 18:33:03 +03:00
AsafMah d16a2715ee
Add metadata endpoint (#177)
* Kusto now queries the provided cluster for metadata. This fixes incompatibility issues with other clouds, or services like Synapse. The results are cached and don't require any changes to the user's code or behavior.
2021-06-30 10:41:31 +03:00
KustoIbizaExtension Build f70cf8b8c0 2.7.1 2021-06-29 15:49:20 +03:00
ohad bitton a110f859f2
githubrepo usr (#173) 2021-06-29 15:30:16 +03:00
ohad bitton b2155aa5e8
Primitive object getters to support Null values (#176)
* new API to get primitive as objects to handle null values

* nulls

* better

* comments

* comments

Co-authored-by: KustoIbizaExtension Build <kustodev@microsoft.com>
2021-06-29 13:47:00 +03:00
AsafMah 1f1d1245b4
Fixed old readme code (#178) 2021-06-27 14:02:48 +03:00
ohad bitton 03aabae864
Exceptions handling (#174)
* exception handling

* nicer errors

* permanency

* is permanent exceptions

* isPermanent as triState

* enum triState

* enum triState

* better errors

* nit

* naming - KustoServiceQueryError

Co-authored-by: KustoIbizaExtension Build <kustodev@microsoft.com>
2021-05-25 15:54:20 +03:00
Yihezkel Schoenbrun 2bb0d1b8b8
Upgrade version from 2.6.0 to 2.7.0 (#172) 2021-04-11 21:30:29 +03:00
Yihezkel Schoenbrun ad652df53a
Add streaming query API (#170)
* Add streaming query API

* - Add some resource closing enhancements
- Wrap the CloseParentResourcesStream in a EofSensorInputStream, as opposed to the converse

* Add TODO to reuse HttpClient

* Use existing Java exception formatting, which is an improvement over the .NET exception
2021-04-11 18:46:34 +03:00
ohad bitton 133b5e254f
Device authentication (#169)
* device authentication

* revert device E2E

* comments

* make base class protected

* make base class protected
2021-03-22 18:31:14 +02:00
Yihezkel Schoenbrun 97ae1807cb
Upgrade version to 2.5.1 (#168) 2021-03-11 12:08:33 +02:00
Yihezkel Schoenbrun 9a5976860c
Add new API to query returning a json result (#166)
* Add new API to query so that the result is a json. When the caller doesn't need the Java object, this saves time converting to a Java object in the SDK and from the caller converting from the Java object.

* - Split input variables validation
- trim() command

* Rename from executeForJsonResult to executeToJsonResult

* Rename from executeForJsonResult to executeToJsonResult

* Streaming endpoint is always v1
2021-03-09 12:39:38 +02:00
Yihezkel Schoenbrun ce1a716062
Optimize and upgrade dependency versions (#167)
* - Optimize and upgrade dependency versions
- Remove dependency duplicates/conflicts
- Resolve mvn warnings

* - Use range to ensure specific minor version of jackson dependencies
- Upgrade flatten-maven-plugin
2021-03-08 17:31:42 +02:00
Yihezkel Schoenbrun 6ae22dcb6f
Optimize ResourceManager and minor improvements in a few other classes (#163)
* Optimize ResourceManager and minor improvements in a few other classes

* Change naming from storageRoot to storageUrl
2021-03-03 19:23:55 +02:00
Yihezkel Schoenbrun f6c5b36cc3
Upgrade version from 2.4.2 to to 2.5.0 (#164) 2021-02-14 10:56:46 +02:00
maltalex 1986a5789f
added classes for generating pojos from KustoResultSetTable instances (#159)
* added classes for generating pojos from KustoResultSetTable instances

This commit includes three new classes:
1. KustoType which is a generic class for representing different Kusto
column types and bind them to different Java types

2. KustoColumn which represents a Kusto column - it has a name,
nullability information, and a type (KustoType)

3. KustoResultMapper which can be set up to parse KustoResultSetTable
instances and return a list of pojos. The setup phase is done using a
builder that takes the pojo constructor, as well as zero or more
instances of KustoColumn along with setter functions to set pojo's
fields based on the column values.

This mechanism can potentially be extended to use reflection based on
the target pojo class instead of the manual KustoResultMapper setup

* Update data/src/main/java/com/microsoft/azure/kusto/data/KustoType.java

Changed documentation link to international version

Co-authored-by: ohad bitton <32278684+ohadbitt@users.noreply.github.com>

* Use String.format() for exception messages

* Introduced ObjectPopulator class, ordinal column mapping

- Unified KustoColumn and QueryResultColumnInfo into the new
ObjectPopulator class
- Added support for manually specified column ordinals
- extractList finds column indexes once per result set to save on column
lookups

* KustoResultMapper extractSingle - don't create empty objects

If the KustoResultSetTable is null, the proper response is to return a
null object, not an unpopulated one

* ObjectPopulator - always use column index, formatting

populateFrom used to get objects from the ResultSet by the column name
unless an ordinal was set. Now it always uses the ordinal (looking it up
if necessary).

* KustoType formatting - don't align field declarations

* KustoResultMapperTest

The test uses a mocked KustoResultMapper to test the pojo mapping
functionality of the KustoResultMapper

* Update KustoType.java

* Removed addNonNullableColumn/addNonNullableColumn, added javadoc

Instead of individual addNonNullableColumn/addNullableColumn methods,
exposed the more generic addColumn methods. Additionally, added javadoc
to document the addColumn parameters

* Renamed ObjectPopulator to KustoResultColumnPopulator

* KustoResultColumnPopulator::populateFrom use passed ordinal

populateFrom used to always lookup the column ordinal by name instead of
using the passed ordinal. Now it's always using the ordinal, moving the
responsibility of correctly determining that ordinal to the caller.

* renamed variable in KustoResultColumnPopulator::populateFrom

* KustoResultMapper::extractList renamed variable

* added "single" to names of tests of KustoResultMapper::extractSingle

* Javadoc fixes in KustoType and KustoResultMapper

Co-authored-by: ohad bitton <32278684+ohadbitt@users.noreply.github.com>
2021-02-05 02:15:04 +02:00
Yihezkel Schoenbrun f4da15d312
Rearchitect the AAD authentication code to be object oriented (#160)
* Rearchitect the AAD authentication code to be object oriented and follow best-practices (Java and otherwise)

* Rearchitect the AAD authentication code to be object oriented and follow best-practices (Java and otherwise)

* Code review comments:
- Rename to CallbackTokenProvider
- Remove 2 unnecessarily-passed authorityIds

* Add another layer of abstraction (MsalTokenProvider)

* Add another layer of abstraction (MsalTokenProvider)

* Add Override annotation per code review comment
2021-01-07 13:15:08 +02:00
Yihezkel Schoenbrun 2e05191f2a
Replace ADAL authentication library with MSAL (#155)
* Convert from ADAL to MSAL (include a few questions to be resolved during code review)

* Resolve some TODOs

* Some minor changes and some changes from code review

* Incorporate most review comments

* Add '/' to authority to resolve issue.

* Per Yochai's request, first try to access the token silently, and if that fails authenticate from scratch

* Make the method determineAadAuthorityUrl() less confusing

* Fix error

* Fix test
2020-12-20 19:42:18 +02:00
Ohad Bitton 8e6e6ffe95 v2.4.2 2020-12-13 13:39:06 +02:00
ohad bitton c5079020c9
Remove federated url path if set (#152)
* remove federated url path if set

* ignore case

* better

* test

* fix test

* raw format

* comments

* comments

Co-authored-by: Ohad Bitton <ohbitton@microsoft.com>
2020-12-13 13:36:41 +02:00
ohad bitton 3e30e743e1
Better exception message in post request (#156)
* better exception message in post request

* v2.4.1

Co-authored-by: Ohad Bitton <ohbitton@microsoft.com>
2020-11-19 14:04:26 +02:00
Ohad Bitton f48266e41d v2.4.0 2020-11-18 15:37:50 +02:00
Ohad Bitton 99b6a6d2ea Add error.message to the Message of execute 2020-11-18 15:36:27 +02:00
ohbitton fc3b8a0c63 Merge remote-tracking branch 'origin/master' 2020-10-26 17:16:32 +02:00
ohbitton d07ae36e95 revert creds 2020-10-26 17:15:05 +02:00
Yihezkel Schoenbrun a75db70f3a
Streaming client wrong endpoint detection (#149)
* Streaming client wrong endpoint detection

* Fix invalid character for the file's encoding

* Add parent class to both Queued and Streaming IngestClients for the local purpose of removing significant code duplication in the wrong-endpoint-detection feature.
This change represents a better architecture that will yield further benefits.

* Rename AbstractIngestClient to IngestClientBase
2020-10-13 21:02:22 +03:00
AsafMah 9dce220692
ManagedStreamingIngestClient (#151)
Adds ManagedStreamingIngestClient to support multiple streaming retries and queue fallback.



commits:
* First commit, create file and basic members

* basic copy-paste argument validation, close streams on close.
no logic yet

* Copy ctors for all the needed types

* Filled out other methods (Like in the c# manager, all of them redirect to stream, except blob which goes directly to the queued ingestor)

* Simplest support for actual streaming

* Fixed with new name for the queued client

* Removed unsued stuff for now, added doc comment.

* Some small fixes from testing -
 - Log exception
 - Add a direct c-tor
 - Catch all exception types, since they may be unpredictable

* Reset the stream after an exception

* Adding tests for the class

* cleanup imports

* Added annotations as an explicit dependency(like in data) to appease CI.

* Update ingest/src/main/java/com/microsoft/azure/kusto/ingest/ManagedStreamingIngestClient.java

grammar

Co-authored-by: boazsha <15858748+boazsha@users.noreply.github.com>

* Update ingest/src/main/java/com/microsoft/azure/kusto/ingest/ManagedStreamingIngestClient.java

grammar

Co-authored-by: boazsha <15858748+boazsha@users.noreply.github.com>

* Change retry count to 3

* Made the json file tests different from each other, plus they now check the stream.

The gz file was changed since the old one had CRLF line endings, while the uncompressed one had LF.

* Documentation - added a note to explain ingestFromBlob's behaviour, and some tiny grammar fixes.

* Removed default compile annotation

* Update ingest/src/main/java/com/microsoft/azure/kusto/ingest/ManagedStreamingIngestClient.java

Co-authored-by: Boaz Shalom <15858748+boazsha@users.noreply.github.com>

* Removed todo comments from tests, since we decided to keep them this way

* Pass the to the StreamSourceInfo ctor whenever applicable

* Make comments fit the style

* Added doc for ingestFromBlob function

* Added factory for managed streaming ingest client

* Fixed managedingest from files - since FileInputStream isn't resettable, we can't use managed with it, so I added a class for it and a test.

* Reset the mock properly

* Add license

* Parsing permanent exceptions from the api (marked as @permanent=true in the returning json) and stopping if it is one.

* Reset the client in all tests

* Made compressedJson test work despite the fact that the stream closes in the end

* Adding debug prints to the comparison test since I don't know how else to check tests that run on my machine but fail on the testing machine

* Try using alternative method of reading string to avoid newline issue

* Also fixed the other one to make the tests pass, but we'll still have to look into why the file changes on the test machine

* Add UncloseableStream class

* Fixed typo

* Solve the newlines problem by hardcoding the string result into the test file.

* Use UncloseableStream in utils (still needs tests)

* Update ingest/src/main/java/com/microsoft/azure/kusto/ingest/ManagedStreamingIngestClient.java

Co-authored-by: ohad bitton <32278684+ohadbitt@users.noreply.github.com>

* Use proper reset function in tests

* Unit test UncloseableStream

* Correct format for web error

Co-authored-by: boazsha <15858748+boazsha@users.noreply.github.com>
Co-authored-by: ohad bitton <32278684+ohadbitt@users.noreply.github.com>
2020-10-13 13:15:30 +03:00
ohad bitton a1417109a2
Expose authority id for all authenticaiton methods (#153)
* Expose authority ID in all authentication methods

* version 2.3.2

* version 2.3.2
2020-09-30 17:56:36 +03:00
Ohad Bitton 2fdff9e618 version 2.3.1 2020-09-08 13:12:05 +03:00
Ohad Bitton b21fc31938 support clientRequestId 2020-09-08 12:55:05 +03:00
ohad bitton 59aa42e2c5
Accept json response + fix maven build warnings (#150)
* accept application/json + use same jackson version as spark connector

* version 2.3.0

* restrain nimbus version (resolve nimbus class not found)

* Fix maven warnings

* Fix maven warnings

* Update data/pom.xml

Co-authored-by: vladikbr <31644896+vladikbr@users.noreply.github.com>

* clean

Co-authored-by: Ohad Bitton <ohbitton@microsoft.com>
Co-authored-by: vladikbr <31644896+vladikbr@users.noreply.github.com>
2020-09-07 10:00:03 +03:00
Yihezkel Schoenbrun b1d3900dde
Add detection of wrong endpoint with correct endpoint URI suggestion (#143)
* Add detection of wrong endpoint with correct endpoint URI suggestion

* Fix code review comments

* Remove extraneous comment from test

* Queued Ingestion's wrong endpoint detection is more generic to reduce code duplication if the same feature is added for Streaming Ingestion.

Co-authored-by: ohad bitton <32278684+ohadbitt@users.noreply.github.com>
2020-09-02 08:44:45 +03:00
Ohad Bitton 4a64402e70 v2.2.0 2020-08-27 16:13:56 +03:00
ohad bitton 0e1112a98e
Support authentication via callable (#148)
* support authentication via callable

* naming

Co-authored-by: Ohad Bitton <ohbitton@microsoft.com>
2020-08-27 15:53:48 +03:00