Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RDBC-767 Python Client - time series 4 #197

Merged
merged 49 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
77e9e5d
RDBC-767 TimeSeriesRangesCacheTest::shouldMergeTimeSeriesRangesInCache
poissoncorp Dec 12, 2023
ff6c2d6
RDBC-767 TimeSeriesRangesCacheTest::canHandleRangesWithNoValues
poissoncorp Dec 12, 2023
580fa08
RDBC-767 TimeSeriesRangesCacheTest::shouldMergeTimeSeriesRangesInCache2
poissoncorp Dec 12, 2023
99ae885
RDBC-767 TimeSeriesRangesCacheTest::shouldMergeTimeSeriesRangesInCache3
poissoncorp Dec 13, 2023
714206f
RDBC-767 TimeSeriesRangesCacheTest::shouldGetPartialRangeFromCache2
poissoncorp Dec 13, 2023
1ed83df
RDBC-767 TimeSeriesOperationsTest::canGetMultipleRangesInSingleRequest
poissoncorp Dec 13, 2023
22c3040
RDBC-767 TimeSeriesOperationsTest::canGetMultipleRangesInSingleRequest
poissoncorp Dec 13, 2023
29c5ac5
RDBC-767 TimeSeriesOperationsTest::getMultipleTimeSeriesShouldThrowOn…
poissoncorp Dec 14, 2023
1b6d696
RDBC-767 TimeSeriesOperationsTest::shouldThrowOnNullOrEmptyRanges
poissoncorp Dec 14, 2023
ffe9063
RDBC-767 TimeSeriesConfigurationTest
poissoncorp Dec 14, 2023
b1f74f9
TimeSeriesTypedSessionTest::mappingNeedsToContainConsecutiveValuesSta…
poissoncorp Dec 14, 2023
2f15009
TimeSeriesRawQueryTest::canQueryTimeSeriesAggregation_DeclareSyntax_M…
poissoncorp Dec 14, 2023
ecce6ed
RDBC-767 TimeSeriesRawQueryTest::canQueryTimeSeriesAggregation_NoSele…
poissoncorp Dec 14, 2023
d6f1a0e
RDBC-767 TimeSeriesRawQueryTest::canQueryTimeSeriesAggregation_Declar…
poissoncorp Dec 14, 2023
70f9b20
RDBC-767 RavenDB_15029Test::sessionRawQueryShouldNotTrackTimeSeriesRe…
poissoncorp Dec 14, 2023
119cc20
RDBC-767 TimeSeriesConfigurationTest::notValidConfigureShouldThrow
poissoncorp Dec 14, 2023
23a5f67
RDBC-767 TimeSeriesIncludesTest::shouldThrowOnIncludingTimeSeriesWith…
poissoncorp Dec 14, 2023
263c3ec
RDBC-767 TimeSeriesIncludesTest::shouldThrowOnIncludingTimeSeriesWith…
poissoncorp Dec 14, 2023
a2985a7
RDBC-767 TimeSeriesIncludesTest::shouldThrowOnIncludeAllTimeSeriesAft…
poissoncorp Dec 14, 2023
d394824
RDBC-767 TimeSeriesIncludesTest::shouldThrowOnIncludingTimeSeriesAfte…
poissoncorp Dec 14, 2023
9d3a65d
RDBC-767 TimeSeriesOperationsTest::getTimeSeriesShouldThrowOnMissingName
poissoncorp Dec 15, 2023
77cd5a8
RDBC-767 TimeSeriesIncludesTest::shouldThrowOnIncludingTimeSeriesWith…
poissoncorp Dec 15, 2023
6a4a2bb
RDBC-767 TimeSeriesSessionTest::getAllTimeSeriesNamesWhenNoTimeSeries
poissoncorp Dec 15, 2023
ad7f4d9
RDBC-767 TimeSeriesOperationsTest::canDeleteLargeRange
poissoncorp Dec 15, 2023
6b3fdd8
RDBC-767 TimeSeriesOperationsTest::shouldThrowOnAttemptToCreateTimeSe…
poissoncorp Dec 15, 2023
9df4e51
RDBC-767 TimeSeriesConfigurationTest::canConfigureTimeSeries2
poissoncorp Dec 15, 2023
22844ab
RDBC-767 TimeSeriesOperationsTest -s and TimeSeriesTypedSessionTest -s
poissoncorp Dec 18, 2023
8c6c0f7
RDBC-767 Separated cyclic deps
poissoncorp Dec 18, 2023
e25a18a
RDBC-767 TimeSeriesConfigurationTest::canConfigureTimeSeries3
poissoncorp Dec 18, 2023
06c0d15
RDBC-767 TimeSeriesOperationsTest::canGetNonExistedRange
poissoncorp Dec 18, 2023
9d03994
RDBC-767 TimeSeriesOperationsTest::canCreateAndGetSimpleTimeSeriesUsi…
poissoncorp Dec 18, 2023
83806ab
RDBC-767 Skip failing tests due to license on cicd
poissoncorp Dec 18, 2023
8bd9085
RDBC-767 TimeSeriesOperationsTest::canStoreAndReadMultipleTimestampsU…
poissoncorp Dec 18, 2023
cdf7869
RDBC-767 TimeSeriesOperationsTest::canAppendAndRemoveTimestampsInSing…
poissoncorp Dec 18, 2023
0f2b0a6
RDBC-767 canRegisterTimeSeriesForOtherDatabase
poissoncorp Dec 18, 2023
46dc888
RDBC-767 canRegisterTimeSeries
poissoncorp Dec 18, 2023
1e60175
RDBC-767 canRegisterTimeSeriesWithCustomName
poissoncorp Dec 18, 2023
c7671c1
RDBC-767 RavenDB_15246Test::resultsWithRangeAndPageSize
poissoncorp Dec 19, 2023
2b16db2
RDBC-767 RavenDB_15246Test::testClientCacheWithStart
poissoncorp Dec 19, 2023
ea5056b
RDBC-767 RavenDB_15246Test::getResultsWithRange
poissoncorp Dec 19, 2023
2a20091
RDBC-767 RavenDB_15246Test::resultsWithRangeAndStart
poissoncorp Dec 19, 2023
0a1f9ac
RDBC-767 RavenDB_15246Test::testRanges
poissoncorp Dec 19, 2023
a5c2428
RDBC-767 RavenDB_15246Test::testClientCacheWithPageSize
poissoncorp Dec 19, 2023
367c1c4
RDBC-767 canGetTimeSeriesWithInclude_CacheNotEmpty2
poissoncorp Dec 19, 2023
41f6f0b
RDBC-767 RavenDB_14164Test::canGetMultipleRangesWithIncludes
poissoncorp Dec 19, 2023
6a1efdd
RDBC-767 RavenDB_15792Test::canQueryTimeSeriesWithSpacesInName
poissoncorp Dec 19, 2023
0c78ce5
RDBC-767 RavenDB_16906Test::timeSeriesFor_ShouldThrowBetterError_OnNu…
poissoncorp Dec 19, 2023
844ba7a
RDBC-767 RavenDB_13100Test
poissoncorp Dec 20, 2023
8cb248a
RDBC-767 Time Series AppendOperation perf
poissoncorp Dec 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ravendb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@
GetCompareExchangeValuesOperation,
DeleteCompareExchangeValueOperation,
)
from ravendb.documents.operations.configuration import (
from ravendb.documents.operations.configuration.operations import (
GetServerWideClientConfigurationOperation,
PutServerWideClientConfigurationOperation,
ClientConfiguration,
GetClientConfigurationOperation,
PutClientConfigurationOperation,
StudioConfiguration,
StudioEnvironment,
)
from ravendb.documents.operations.configuration.definitions import StudioConfiguration, StudioEnvironment

from ravendb.documents.operations.connection_strings import ConnectionString
from ravendb.documents.operations.etl.configuration import EtlConfiguration, RavenEtlConfiguration
from ravendb.documents.operations.etl.olap import OlapEtlConfiguration
Expand Down
1 change: 0 additions & 1 deletion ravendb/documents/commands/batches.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
)
from ravendb.documents.operations.time_series import TimeSeriesOperation
from ravendb.documents.session.misc import TransactionMode, ForceRevisionStrategy
from ravendb.documents.time_series import TimeSeriesOperations
from ravendb.http.raven_command import RavenCommand
from ravendb.http.server_node import ServerNode
from ravendb.json.result import BatchCommandResult
Expand Down
6 changes: 5 additions & 1 deletion ravendb/documents/conventions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
from typing import TypeVar
from ravendb.json.metadata_as_dictionary import MetadataAsDictionary
from ravendb.primitives import constants
from ravendb.documents.operations.configuration import ClientConfiguration, LoadBalanceBehavior, ReadBalanceBehavior
from ravendb.documents.operations.configuration.definitions import (
ClientConfiguration,
LoadBalanceBehavior,
ReadBalanceBehavior,
)
from ravendb.documents.indexes.definitions import SortOptions
from ravendb.tools.utils import Utils

Expand Down
2 changes: 1 addition & 1 deletion ravendb/documents/indexes/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ def detect_static_index_source_type(map_str: str) -> IndexSourceType:

tokens = [token for token in map_lower.split(" ", 4) if token]

if len(tokens) > 4 and tokens[2].lower() == "in":
if len(tokens) >= 4 and tokens[2].lower() == "in":
if tokens[3].startswith("timeseries"):
return IndexSourceType.TIME_SERIES
if tokens[3].startswith("counters"):
Expand Down
Empty file.
69 changes: 69 additions & 0 deletions ravendb/documents/operations/configuration/definitions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
from __future__ import annotations
from enum import Enum
from typing import Optional, Union

from ravendb.http.misc import ReadBalanceBehavior, LoadBalanceBehavior


class StudioEnvironment(Enum):
NONE = "NONE"
DEVELOPMENT = "DEVELOPMENT"
TESTING = "TESTING"
PRODUCTION = "PRODUCTION"


class StudioConfiguration:
def __init__(self, disabled: Optional[bool] = None, environment: Optional[StudioEnvironment] = None):
self.disabled = disabled
self.environment = environment


class ClientConfiguration:
def __init__(self):
self.__identity_parts_separator: Union[None, str] = None
self.etag: int = 0
self.disabled: bool = False
self.max_number_of_requests_per_session: Optional[int] = None
self.read_balance_behavior: Optional[ReadBalanceBehavior] = None
self.load_balance_behavior: Optional[LoadBalanceBehavior] = None
self.load_balancer_context_seed: Optional[int] = None

@property
def identity_parts_separator(self) -> str:
return self.__identity_parts_separator

@identity_parts_separator.setter
def identity_parts_separator(self, value: str):
if value is not None and "|" == value:
raise ValueError("Cannot set identity parts separator to '|'")
self.__identity_parts_separator = value

def to_json(self) -> dict:
return {
"IdentityPartsSeparator": self.__identity_parts_separator,
"Etag": self.etag,
"Disabled": self.disabled,
"MaxNumberOfRequestsPerSession": self.max_number_of_requests_per_session,
"ReadBalanceBehavior": self.read_balance_behavior.value
if self.read_balance_behavior
else ReadBalanceBehavior.NONE,
"LoadBalanceBehavior": self.load_balance_behavior.value
if self.load_balance_behavior
else LoadBalanceBehavior.NONE,
"LoadBalancerContextSeed": self.load_balancer_context_seed,
}

@classmethod
def from_json(cls, json_dict: dict) -> Optional[ClientConfiguration]:
if json_dict is None:
return None
config = cls()
config.__identity_parts_separator = json_dict["IdentityPartsSeparator"]
config.etag = json_dict["Etag"]
config.disabled = json_dict["Disabled"]
config.max_number_of_requests_per_session = json_dict["MaxNumberOfRequestsPerSession"]
config.read_balance_behavior = ReadBalanceBehavior(json_dict["ReadBalanceBehavior"])
config.load_balance_behavior = LoadBalanceBehavior(json_dict["LoadBalanceBehavior"])
config.load_balancer_context_seed = json_dict["LoadBalancerContextSeed"]

return config
Original file line number Diff line number Diff line change
@@ -1,85 +1,21 @@
from __future__ import annotations

import json
from enum import Enum
from typing import Union, Optional, TYPE_CHECKING
from typing import TYPE_CHECKING

import requests

from ravendb.documents.operations.configuration.definitions import ClientConfiguration
from ravendb.documents.operations.definitions import VoidMaintenanceOperation, MaintenanceOperation
from ravendb.http.raven_command import RavenCommand, VoidRavenCommand
from ravendb.http.server_node import ServerNode
from ravendb.http.topology import RaftCommand
from ravendb.serverwide.operations.common import ServerOperation, VoidServerOperation
from ravendb.util.util import RaftIdGenerator
from ravendb.http.misc import ReadBalanceBehavior, LoadBalanceBehavior

if TYPE_CHECKING:
from ravendb.documents.conventions import DocumentConventions


class StudioEnvironment(Enum):
NONE = "NONE"
DEVELOPMENT = "DEVELOPMENT"
TESTING = "TESTING"
PRODUCTION = "PRODUCTION"


class StudioConfiguration:
def __init__(self, disabled: Optional[bool] = None, environment: Optional[StudioEnvironment] = None):
self.disabled = disabled
self.environment = environment


class ClientConfiguration:
def __init__(self):
self.__identity_parts_separator: Union[None, str] = None
self.etag: int = 0
self.disabled: bool = False
self.max_number_of_requests_per_session: Union[None, int] = None
self.read_balance_behavior: Union[None, "ReadBalanceBehavior"] = None
self.load_balance_behavior: Union[None, "LoadBalanceBehavior"] = None
self.load_balancer_context_seed: Union[None, int] = None

@property
def identity_parts_separator(self) -> str:
return self.__identity_parts_separator

@identity_parts_separator.setter
def identity_parts_separator(self, value: str):
if value is not None and "|" == value:
raise ValueError("Cannot set identity parts separator to '|'")
self.__identity_parts_separator = value

def to_json(self) -> dict:
return {
"IdentityPartsSeparator": self.__identity_parts_separator,
"Etag": self.etag,
"Disabled": self.disabled,
"MaxNumberOfRequestsPerSession": self.max_number_of_requests_per_session,
"ReadBalanceBehavior": self.read_balance_behavior.value
if self.read_balance_behavior
else ReadBalanceBehavior.NONE,
"LoadBalanceBehavior": self.load_balance_behavior.value
if self.load_balance_behavior
else LoadBalanceBehavior.NONE,
"LoadBalancerContextSeed": self.load_balancer_context_seed,
}

@classmethod
def from_json(cls, json_dict: dict) -> Optional[ClientConfiguration]:
if json_dict is None:
return None
config = cls()
config.__identity_parts_separator = json_dict["IdentityPartsSeparator"]
config.etag = json_dict["Etag"]
config.disabled = json_dict["Disabled"]
config.max_number_of_requests_per_session = json_dict["MaxNumberOfRequestsPerSession"]
config.read_balance_behavior = ReadBalanceBehavior(json_dict["ReadBalanceBehavior"])
config.load_balance_behavior = LoadBalanceBehavior(json_dict["LoadBalanceBehavior"])
config.load_balancer_context_seed = json_dict["LoadBalancerContextSeed"]

return config
from ravendb.serverwide.operations.common import ServerOperation, VoidServerOperation


class GetClientConfigurationOperation(MaintenanceOperation):
Expand Down
Loading
Loading