-
Notifications
You must be signed in to change notification settings - Fork 387
Python example
Here is a complete Python program that inserts ['A','BB']
into space[0]
via the high-level Python API. To prepare, paste the code into a file named example.py
, and install tarantool-python
:
$ pip install tarantool
Before trying to run, check that the server (tarantool_box) is running on localhost (127.0.0.1) and its primary port is the default (33013) and space[0]'s primary key type is string (space[0].index[0].key_field[0].type = "STR" in configuration file).
To run, say python example.py. The program will connect to the server, send the request and won't throw exception if all went well. If the row already exists, the program will throw DatabaseException(“Duplicate key exists in unique index 0”).
#!/usr/bin/python
from tarantool import Connection
c = Connection("127.0.0.1", 33013)
result = c.insert(0, 'A','BB')
print result
The example program only shows one command and does not show all that's necessary for good practice.
For future information, please, read Documentation
- C coding guidelines ↗
- Lua coding guidelines ↗
- Python coding guidelines ↗
- Maintainer's guide
- Debugging
Architecture
- Server architecture
- R tree index quick start and usage
- LuaJIT
- Vinyl
- Vinyl Architecture
- Vinyl Disk Layout
- Vinyl math
- Vinyl Cookbook
- Bullet1
- SQL
- Appserver modules
- Testing
- Performance
- Privileges and Access control
How To ...?
- ... configure build system
- ... add new fuzzers
- ... build RPM or Deb package using packpack
- ... calculate memory size
- ... debug core dump of stripped tarantool
- ... debug core from different OS
- ... debug fuzzer
- ... generate new bootstrap snapshot
- ... use Address Sanitizer
- ... collect a coredump
- ... generate luacov report for builtin module
- ... verify modified lua files via luacheck
- ... verify Lua files in third_party?
- ... rerun failed jobs
- ... update a third party repository
- Fix wrong decimal indexing after upgrade to 2.10.1
- Caveats when upgrading a cluster on Tarantool 1.6
- Fix illegal field type in a space format when upgrading to 2.10.4
Useful links