Skip to content

Commit 9ba149b

Browse files
author
Roman Kisel
committed
Merge branch 'main' into release-6.0
2 parents be27b21 + 9e07ac1 commit 9ba149b

File tree

3 files changed

+67
-1
lines changed

3 files changed

+67
-1
lines changed

src/swig/common.i

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,22 @@ public:
144144
Can potentially reduce max throughput and increase CPU use / network bandwidth usage.");
145145
bool minLatency;
146146

147+
%feature("autodoc", "");
148+
149+
%pythoncode %{
150+
151+
def withSpaces(self, spaces: 'list[str]') -> None:
152+
'''List of spaces to select data from.
153+
154+
If set to None then data from all spaces is loaded.
155+
'''
156+
self.__withSpaces(spaces)
157+
158+
%}
159+
160+
%rename(__withSpaces) withSpaces;
161+
void withSpaces(const std::vector<std::string> *spaces);
162+
147163
};
148164

149165
%feature("autodoc", "Options for loading data into a stream.

tests/TestStream.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,5 +140,55 @@ def test_Spaces(self):
140140
finally:
141141
self.deleteStream(key)
142142

143+
def test_ReadFromSpaces(self):
144+
key = 'BarsWithSpaces'
145+
try:
146+
stream = self.createStream(key)
147+
self.assertIsNotNone(stream)
148+
149+
count = 1234
150+
testutils.loadBars(stream, count, 0, 1000000000, ['MSFT', 'ORCL'])
151+
testutils.loadBars(stream, count, 0, 1000000000, ['SX'], 'SpaceX')
152+
testutils.loadBars(stream, count, 0, 1000000000, ['SY'], 'SpaceY')
153+
154+
time.sleep(1)
155+
156+
so = tbapi.SelectionOptions()
157+
# todo: temporary commented until release new server version
158+
# with stream.trySelect(0, so, None, None) as cursor:
159+
# self.checkCursorSymbols(cursor, set(['MSFT', 'ORCL', 'SX', 'SY']))
160+
161+
so = tbapi.SelectionOptions()
162+
so.withSpaces(['SpaceX'])
163+
# todo: temporary commented until release new server version
164+
# with stream.trySelect(0, so, None, None) as cursor:
165+
# self.checkCursorSymbols(cursor, set(['SX']))
166+
167+
so = tbapi.SelectionOptions()
168+
so.withSpaces(['SpaceY'])
169+
# todo: temporary commented until release new server version
170+
# with stream.trySelect(0, so, None, None) as cursor:
171+
# self.checkCursorSymbols(cursor, set(['SY']))
172+
173+
so = tbapi.SelectionOptions()
174+
so.withSpaces(['SpaceY', 'SpaceX'])
175+
# todo: temporary commented until release new server version
176+
# with stream.trySelect(0, so, None, None) as cursor:
177+
# self.checkCursorSymbols(cursor, set(['SY', 'SX']))
178+
179+
so = tbapi.SelectionOptions()
180+
so.withSpaces([''])
181+
# todo: temporary commented until release new server version
182+
# with stream.trySelect(0, so, None, None) as cursor:
183+
# self.checkCursorSymbols(cursor, set(['MSFT', 'ORCL']))
184+
185+
so = tbapi.SelectionOptions()
186+
so.withSpaces(None)
187+
# todo: temporary commented until release new server version
188+
# with stream.trySelect(0, so, None, None) as cursor:
189+
# self.checkCursorSymbols(cursor, set(['MSFT', 'ORCL', 'SX', 'SY']))
190+
finally:
191+
self.deleteStream(key)
192+
143193
if __name__ == '__main__':
144194
unittest.main()

0 commit comments

Comments
 (0)