-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added python examples
- Loading branch information
Showing
8 changed files
with
834 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,8 +182,35 @@ List<KV> zScan2 = immuClient.zScan("set2", 5, false); | |
::: | ||
|
||
::: tab Python | ||
This feature is not yet supported or not documented. | ||
Do you want to make a feature request or help out? Open an issue on [Python sdk github project](https://github.com/codenotary/immudb-py/issues/new) | ||
```python | ||
from immudb import ImmudbClient | ||
|
||
URL = "localhost:3322" # immudb running on your machine | ||
LOGIN = "immudb" # Default username | ||
PASSWORD = "immudb" # Default password | ||
DB = b"defaultdb" # Default database name (must be in bytes) | ||
|
||
def main(): | ||
client = ImmudbClient(URL) | ||
client.login(LOGIN, PASSWORD, database = DB) | ||
client.set(b"user1", b"[email protected]") | ||
client.set(b"user2", b"[email protected]") | ||
client.set(b"user3", b"[email protected]") | ||
client.set(b"user4", b"[email protected]") | ||
|
||
client.zAdd(b"age", 100, b"user1") | ||
client.zAdd(b"age", 101, b"user2") | ||
client.zAdd(b"age", 99, b"user3") | ||
client.zAdd(b"age", 100, b"user4") | ||
|
||
scanResult = client.zScan(b"age", b"", 0, 0, True, 50, False, 100, 101) | ||
print(scanResult) # Shows records with 'age' 100 <= score < 101 | ||
# with descending order and limit = 50 | ||
|
||
|
||
if __name__ == "__main__": | ||
main() | ||
``` | ||
::: | ||
|
||
::: tab Node.js | ||
|
Oops, something went wrong.