Skip to content

Commit 3cd460e

Browse files
committed
fix: only apply replace_keys flag on first batch during segmented key import
1 parent 01e357f commit 3cd460e

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

CHANGES.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,6 @@
4848
3.5.3 (Jul 10, 2025)
4949
- fixed bug in listing large segments
5050
3.5.4 (Aug 12, 2025)
51-
- added method to retrieve segment definition key counts for standard segments
51+
- added method to retrieve segment definition key counts for standard segments
52+
3.5.5 (Sep 8, 2025)
53+
- fixed method to import segment keys of larger (10k+) segment keys appropriately

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "splitapiclient"
7-
version = "3.5.4"
7+
version = "3.5.5"
88
description = "This Python Library provide full support for Split REST Admin API, allow creating, deleting and editing Environments, Splits, Split Definitions, Segments, Segment Keys, Users, Groups, API Keys, Change Requests, Attributes and Identities"
99
classifiers = [
1010
"Programming Language :: Python :: 3",

splitapiclient/resources/segment_definition.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,18 @@ def import_keys_from_json(self, replace_keys, json_data, apiclient=None):
119119
key_batches = [keys[i:i + 10000] for i in range(0, len(keys), 10000)]
120120
success = True
121121
# Process each batch
122+
first_batch = True
122123
for key_batch in key_batches:
123124
# Make a copy of the json_data to avoid modifying the original
124125
batch_data = json_data.copy()
125126
batch_data['keys'] = key_batch
126127
# If any batch fails, mark the entire operation as failed
127-
batch_result = imc.import_keys_from_json(self._name, self._environment['id'], replace_keys, batch_data)
128+
# First batch uses original replace_keys value, subsequent batches use False
129+
batch_replace_keys = replace_keys if first_batch else False
130+
batch_result = imc.import_keys_from_json(self._name, self._environment['id'], batch_replace_keys, batch_data)
128131
if not batch_result:
129132
success = False
133+
first_batch = False
130134
return success
131135
else:
132136
return imc.import_keys_from_json(self._name, self._environment['id'], replace_keys, json_data)

splitapiclient/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '3.5.4'
1+
__version__ = '3.5.5'

0 commit comments

Comments
 (0)