SurrealDB python client written in Rust.
Project description
is the ultimate cloud
database for tomorrow's applications
Develop easier. Build faster. Scale quicker.
surrealdb.py
The official SurrealDB SDK for Python.
Getting Started
Below is a quick guide on how to get started with SurrealDB in Python.
Running SurrealDB
Before we can do anything, we need to download SurrealDB and start the server. See how to do that here
After we have everything up and running, we can install the Python SDK.
Installing the Python SDK
pip install surrealdb
Using the (synchronous) Python methods
Import the SDK and create the database connection:
from surrealdb import SurrealDB
db = SurrealDB("ws://localhost:8000/database/namespace")
Here, we can see that we defined the connection protocol as WebSocket using ws://
. We then defined the host as localhost
and the port as 8000
.
Finally, we defined the database and namespace as database
and namespace
.
We need a database and namespace to connect to SurrealDB.
Now that we have our connection we need to signin:
db.signin({
"username": "root",
"password": "root",
})
We can now run our queries to create some users, select them and print the outcome.
db.query("CREATE user:tobie SET name = 'Tobie';")
db.query("CREATE user:jaime SET name = 'Jaime';")
outcome = db.query("SELECT * FROM user;")
print(outcome)
Using the async Python methods
The async methods work in the same way, with two main differences:
- Inclusion of
async def / await
. - You need to call the connect method before signing in.
import asyncio
from surrealdb import AsyncSurrealDB
async def main():
db = AsyncSurrealDB("ws://localhost:8000/database/namespace")
await db.connect()
await db.signin({
"username": "root",
"password": "root",
})
await db.query("CREATE user:tobie SET name = 'Tobie';")
await db.query("CREATE user:jaime SET name = 'Jaime';")
outcome = await db.query("SELECT * FROM user;")
print(outcome)
# Run the main function
asyncio.run(main())
Using Jupyter Notebooks
The Python SDK currently only supports the AsyncSurrealDB
methods.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file surrealdb-beta-0.0.5.tar.gz
.
File metadata
- Download URL: surrealdb-beta-0.0.5.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9591b69efcfa077ab5912306afba4815c841a6e29f3d2a3c887e3cb7140662d |
|
MD5 | f33f7e091f05a166a58a998883eb2c9d |
|
BLAKE2b-256 | 3a3c784940813bcad035902b53e5518f724d06bdde9abdec45f6bae77066c38f |
File details
Details for the file surrealdb_beta-0.0.5-pp39-pypy39_pp73-win_amd64.whl
.
File metadata
- Download URL: surrealdb_beta-0.0.5-pp39-pypy39_pp73-win_amd64.whl
- Upload date:
- Size: 11.7 MB
- Tags: PyPy, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8882d8e54bb8bd6d9ff87a8b9b5da5e215264e97dd27a2ea91cfa27ede185efa |
|
MD5 | ac557a44f9d339fd205f168ebc9a155f |
|
BLAKE2b-256 | bd9d23d0ebadcb8a509a4ddd9a10daa30137e356a9835a57b0ff78f2b1a52030 |
File details
Details for the file surrealdb_beta-0.0.5-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: surrealdb_beta-0.0.5-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 12.9 MB
- Tags: PyPy, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cb97f09942ec53d6d0cde0c7749c0ff6adbaa7cef683ae5432118f48cc9762b8 |
|
MD5 | a410f4508f963302c51e7af3f0a56513 |
|
BLAKE2b-256 | af04547c6c7dde4bc3b7a3c5cfdcd94cc1d1abc7a49a58b5ad8697d0f31f20a1 |
File details
Details for the file surrealdb_beta-0.0.5-pp39-pypy39_pp73-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: surrealdb_beta-0.0.5-pp39-pypy39_pp73-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 13.6 MB
- Tags: PyPy, manylinux: glibc 2.12+ i686, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 997ca30883f9c41a988ac4c07ac3261bac56c33a89c1704210be92fec19a1a3b |
|
MD5 | e512f1b1a8625c4343b403ab18476f3c |
|
BLAKE2b-256 | 4a460e4e248fcb5a592c09be34f3f1455e6b1b78f8c778120bc56d4d2fb9186d |
File details
Details for the file surrealdb_beta-0.0.5-pp39-pypy39_pp73-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: surrealdb_beta-0.0.5-pp39-pypy39_pp73-macosx_10_9_x86_64.whl
- Upload date:
- Size: 12.0 MB
- Tags: PyPy, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9c837fe49adf6375021e6bbc5cbb51df4aa236a947e9db73b2fb17406daeb67 |
|
MD5 | 1a24199c41305c36fba8065c4d743d0d |
|
BLAKE2b-256 | e9652aac23bc4e3a79751bd5c6536c925efb6a642e518daa5f28679b7b9e4184 |
File details
Details for the file surrealdb_beta-0.0.5-pp38-pypy38_pp73-win_amd64.whl
.
File metadata
- Download URL: surrealdb_beta-0.0.5-pp38-pypy38_pp73-win_amd64.whl
- Upload date:
- Size: 11.7 MB
- Tags: PyPy, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd6a9e02eb3de6902b0a828c73669d651dd31d7d0d8a6bb300cfeb019db144f9 |
|
MD5 | 65db8865938ed3f331be6af69106620c |
|
BLAKE2b-256 | f586059b7cc059152dc24936ba73ae035ab47f5d897b4a350250e3c9f7a0f5f1 |
File details
Details for the file surrealdb_beta-0.0.5-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: surrealdb_beta-0.0.5-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 12.9 MB
- Tags: PyPy, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6052ee5c093c5fc9a81a2966ffd861919b6ba8905023b871e6e7c677b0c5697c |
|
MD5 | 8355d6d71d55f9d8b049608f7efc16e6 |
|
BLAKE2b-256 | 259029f7f97764393b8c39d5b5cc337a8285808386f17c31cba2e8c0ef3ac9e4 |
File details
Details for the file surrealdb_beta-0.0.5-pp38-pypy38_pp73-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: surrealdb_beta-0.0.5-pp38-pypy38_pp73-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 13.6 MB
- Tags: PyPy, manylinux: glibc 2.12+ i686, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3821158cc4adbef7c5542787308f8e47a6dc4df2335bd914ef0bf6c6903768d8 |
|
MD5 | 027803933bf07d5f0cb932c572e59953 |
|
BLAKE2b-256 | 3dab7edf6bf4b3a8ea6fcc2cbb97745e579faf2ca35617e30c95056e31450123 |
File details
Details for the file surrealdb_beta-0.0.5-pp38-pypy38_pp73-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: surrealdb_beta-0.0.5-pp38-pypy38_pp73-macosx_10_9_x86_64.whl
- Upload date:
- Size: 12.0 MB
- Tags: PyPy, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | afee065b8166c12d1601d0a0add21e1e921d9a89b971d8c70afeac76834d4641 |
|
MD5 | a7c819c44643c1fe7c76284da5ddd7c0 |
|
BLAKE2b-256 | 7cdc46a928f8d90e5631a1c215b4c8d46ae9179a3f58c3c7407824f5cdb9e89d |
File details
Details for the file surrealdb_beta-0.0.5-pp37-pypy37_pp73-win_amd64.whl
.
File metadata
- Download URL: surrealdb_beta-0.0.5-pp37-pypy37_pp73-win_amd64.whl
- Upload date:
- Size: 11.7 MB
- Tags: PyPy, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6201b800f3310466910bc1d986d4a6e3e51b177e5482ce0a7c69c07324c878a |
|
MD5 | 52e0ddbb763002230631753475fa6975 |
|
BLAKE2b-256 | 7508442367ecc9d250c54efcee0922636337718825c901c44bcd96d8f96d317e |
File details
Details for the file surrealdb_beta-0.0.5-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: surrealdb_beta-0.0.5-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 12.9 MB
- Tags: PyPy, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e93efbd6e48e8902262c83a2b34959f68a04d19c7d7b171f5612d97425818884 |
|
MD5 | b49980de5474743c04af81b40934a651 |
|
BLAKE2b-256 | dd36cd6ce277c48bbe866d726c4d0a65f3ce9e9e69441b00555d027b012940e6 |
File details
Details for the file surrealdb_beta-0.0.5-pp37-pypy37_pp73-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: surrealdb_beta-0.0.5-pp37-pypy37_pp73-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 13.6 MB
- Tags: PyPy, manylinux: glibc 2.12+ i686, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 944fb154f99d206c5338e90868c31a18b48d8333000221e324da0303b893fe33 |
|
MD5 | a11fdfba1faf15f1216f2afc189fa34e |
|
BLAKE2b-256 | 2f3c48c10e4e87f458933f59a9182c7c752a64778217074d9413dcf9fb67f0b6 |
File details
Details for the file surrealdb_beta-0.0.5-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: surrealdb_beta-0.0.5-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
- Upload date:
- Size: 12.0 MB
- Tags: PyPy, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52affef74e4ce81bd354526ede5feb30d17e8e391ce9b9e9ee34110c48de85ef |
|
MD5 | 318ab635961bedfd15e92fb399fe496b |
|
BLAKE2b-256 | af10714c1f51fe778d8c13de559bbf38dcd9838750470081ec73bcf9483a82da |
File details
Details for the file surrealdb_beta-0.0.5-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: surrealdb_beta-0.0.5-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 11.7 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b6576b47b5624bf271b8045dfd49a9770ffef6da785ff94cedc946286276332 |
|
MD5 | b326c7e1a350b8495ae16eb08ddf44e4 |
|
BLAKE2b-256 | d211680e08988facf70ef20c26a3e2d69696d6b05b74203ab2b08df3094c2863 |
File details
Details for the file surrealdb_beta-0.0.5-cp310-cp310-win32.whl
.
File metadata
- Download URL: surrealdb_beta-0.0.5-cp310-cp310-win32.whl
- Upload date:
- Size: 10.6 MB
- Tags: CPython 3.10, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 364bd6becdea94d93416849c09802429a95fb43b13159829f12c2927455b59d6 |
|
MD5 | 64a0271ef3ea79ea0e8fd69a6741c8aa |
|
BLAKE2b-256 | a269805f10aec661b80813623bdb4abd2722d949cf1a6a83dc9f8d7c498d94a4 |
File details
Details for the file surrealdb_beta-0.0.5-cp310-cp310-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: surrealdb_beta-0.0.5-cp310-cp310-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 12.9 MB
- Tags: CPython 3.10, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ea9da65ab7e82160e82f4a8ba74016643c84d99b7f56d3685e2b5d95842c45b |
|
MD5 | d5fb89e95ec812ab8ce176e11ef21af0 |
|
BLAKE2b-256 | 0441644648dd762ba919d080df1bed18fb1900eb8ca766f1260eaf452215bcba |
File details
Details for the file surrealdb_beta-0.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: surrealdb_beta-0.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 12.9 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 545cd533586ff1d5ffbec2f00c42b4fc62cf4389c4f90bcb7db71f6043e71c13 |
|
MD5 | ea885ba2ed2a4340e4552b8fbfdd88c7 |
|
BLAKE2b-256 | 1da5e6f440976f6a3defe72b602522c86e3ec2124ce630a6b36c675bddd40714 |
File details
Details for the file surrealdb_beta-0.0.5-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
.
File metadata
- Download URL: surrealdb_beta-0.0.5-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 13.6 MB
- Tags: CPython 3.10, manylinux: glibc 2.12+ i686, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad2aea438360a545b6133f274c420752144f417a32d9408bcde46e5cb3424c7c |
|
MD5 | dabcc6666426683ca9e7249f5d0900d3 |
|
BLAKE2b-256 | 4305edd81b57e13da66fafdd76b476f33b0a8fa8c06b1ab48f72b772296c2f7b |
File details
Details for the file surrealdb_beta-0.0.5-cp310-cp310-macosx_11_0_arm64.whl
.
File metadata
- Download URL: surrealdb_beta-0.0.5-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 11.3 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86de0533b71fa8b788b38644d9b8e313ca1a08d4b099d1a4f74df7422c9a0fc6 |
|
MD5 | b2ebe54fce5c4be74c029c6d6a6db76f |
|
BLAKE2b-256 | 1c09e5d185ed86823516999ed79e34cf2dbec25632efcd7e22c411c01e1773a0 |
File details
Details for the file surrealdb_beta-0.0.5-cp310-cp310-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: surrealdb_beta-0.0.5-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 12.0 MB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88c68357b837504c0b6d6452cdd6663f3dd117ed0414331d74c9e62d69a5551d |
|
MD5 | 20448f5a761cb7f94689b30a3d820035 |
|
BLAKE2b-256 | 85a09e58b170f57f51cbd65c40ebcdcd5a42c7b44beb52c386ab82a3b905dfbe |
File details
Details for the file surrealdb_beta-0.0.5-cp310-cp310-macosx_10_9_universal2.whl
.
File metadata
- Download URL: surrealdb_beta-0.0.5-cp310-cp310-macosx_10_9_universal2.whl
- Upload date:
- Size: 23.3 MB
- Tags: CPython 3.10, macOS 10.9+ universal2 (ARM64, x86-64)
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e44f58d929b05ff183fd78a201dd1d81309495abf532b93bbb13a635bd66bd0 |
|
MD5 | de80f1d4188cead8246b552b44500d11 |
|
BLAKE2b-256 | a7ce9c2d81d3dfc5c2990b268b24e102052ec4f110775fc6a75077ca6049f885 |