Comments (4)
would like to have batching support in the client.
from tarantool-python.
A dirty workaround might help for now. Here is a batch insert variant.
from itertools import islice
def load_tarantool(t, items, space_name):
space_sid = t.schema.get_space(space_name).sid
items = iter(items)
chunk_size = 1000
chunk = tuple(islice(items, chunk_size))
n = 0
while chunk:
payload = b''.join(bytes(RequestInsert(t, space_sid, item)) for item in chunk)
t._socket.sendall(payload)
try:
assert all(Response(t, t._read_response()) for _ in chunk)
except SchemaReloadException as e:
t.update_schema(e.schema_version)
continue
n += len(chunk)
chunk = tuple(islice(items, chunk_size))
print(f'inserted {n} items')
from tarantool-python.
Yes, something to reduce round-trips from client to database would certainly be a great feature.
from tarantool-python.
There is no any native support for batching in basic IPROTO requests. Just sending a sequence of inserts isn't nice since some of them may fail in the middle and we won't have any possibility to handle it properly.
On the other hand, crud
module has *_many
methods which is essentially a batch insert/replace/upsert for sharded systems. These handles will be supported as part of the #205 issue. So I'm closing this one in favor of #205
from tarantool-python.
Related Issues (20)
- Documentation version computation is broken HOT 2
- Pack RPM/DEB for obsolete distros
- readthedocs doesn't build on tag HOT 2
- Drop graceful shutdown feature flag HOT 1
- Type hints and type check HOT 2
- IPROTO_ID follow up HOT 1
- Support new authentication mechanisms HOT 4
- Lint Python code
- Exception on connection to server with foreign_key HOT 2
- backward compatibility is broken: module is not compatible with cartridge remote control
- Update favicon config
- Make pandas dependency optional HOT 1
- Remove `box.info.cluster.uuid` usage from tests
- Create connection from socket fd
- Do not use box.session.push
- Need to fix dbapi implementation HOT 1
- Support connecting to a file descriptor HOT 1
- Support watchers (subscription to server events) HOT 1
- Use tt instead of tarantoolctl in usage instructions
- rm this
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tarantool-python.