<br>
<p align="center">
<img width=120 src="https://raw.githubusercontent.com/surrealdb/icons/main/surreal.svg" />
<img width=120 src="https://raw.githubusercontent.com/surrealdb/icons/main/python.svg" />
</p>
<h3 align="center">The official SurrealDB SDK for Python.</h3>
<br>
<p align="center">
<a href="https://github.com/surrealdb/surrealdb.py"><img src="https://img.shields.io/badge/status-stable-ff00bb.svg?style=flat-square"></a>
<a href="https://surrealdb.com/docs/integration/libraries/python"><img src="https://img.shields.io/badge/docs-view-44cc11.svg?style=flat-square"></a>
<a href="https://pypi.org/project/surrealdb/"><img src="https://img.shields.io/pypi/v/surrealdb?style=flat-square"></a>
<a href="https://pypi.org/project/surrealdb/"><img src="https://img.shields.io/pypi/dm/surrealdb?style=flat-square"></a>
<a href="https://pypi.org/project/surrealdb/"><img src="https://img.shields.io/pypi/pyversions/surrealdb?style=flat-square"></a>
</p>
<p align="center">
<a href="https://surrealdb.com/discord"><img src="https://img.shields.io/discord/902568124350599239?label=discord&style=flat-square&color=5a66f6"></a>
<a href="https://twitter.com/surrealdb"><img src="https://img.shields.io/badge/twitter-follow_us-1d9bf0.svg?style=flat-square"></a>
<a href="https://www.linkedin.com/company/surrealdb/"><img src="https://img.shields.io/badge/linkedin-connect_with_us-0a66c2.svg?style=flat-square"></a>
<a href="https://www.youtube.com/channel/UCjf2teVEuYVvvVC-gFZNq6w"><img src="https://img.shields.io/badge/youtube-subscribe-fc1c1c.svg?style=flat-square"></a>
</p>
# surrealdb.py
The official SurrealDB SDK for Python.
## Documentation
View the SDK documentation [here](https://surrealdb.com/docs/integration/libraries/python).
## How to install
```sh
pip install surrealdb
```
# Quick start
In this short guide, you will learn how to install, import, and initialize the SDK, as well as perform the basic data manipulation queries.
This guide uses the `Surreal` class, but this example would also work with `AsyncSurreal` class, with the addition of `await` in front of the class methods.
## Install
```sh
pip install surrealdb
```
## Learn the basics
```python
# Import the Surreal class
from surrealdb import Surreal
# Using a context manger to automatically connect and disconnect
with Surreal("ws://localhost:8000/rpc") as db:
db.signin({"username": 'root', "password": 'root'})
db.use("namepace_test", "database_test")
# Create a record in the person table
db.create(
"person",
{
"user": "me",
"password": "safe",
"marketing": True,
"tags": ["python", "documentation"],
},
)
# Read all the records in the table
print(db.select("person"))
# Update all records in the table
print(db.update("person", {
"user":"you",
"password":"very_safe",
"marketing": False,
"tags": ["Awesome"]
}))
# Delete all records in the table
print(db.delete("person"))
# You can also use the query method
# doing all of the above and more in SurrealQl
# In SurrealQL you can do a direct insert
# and the table will be created if it doesn't exist
# Create
db.query("""
insert into person {
user: 'me',
password: 'very_safe',
tags: ['python', 'documentation']
};
""")
# Read
print(db.query("select * from person"))
# Update
print(db.query("""
update person content {
user: 'you',
password: 'more_safe',
tags: ['awesome']
};
"""))
# Delete
print(db.query("delete person"))
```
## Next steps
Now that you have learned the basics of the SurrealDB SDK for Python, you can learn more about the SDK and its methods [in the methods section](https://surrealdb.com/docs/sdk/python/methods) and [data types section](https://surrealdb.com/docs/sdk/python/data-types).
## Contributing
Contributions to this library are welcome! If you encounter issues, have feature requests, or
want to make improvements, feel free to open issues or submit pull requests.
Raw data
{
"_id": null,
"home_page": "https://github.com/surrealdb/surrealdb.py",
"name": "surrealdb",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "SurrealDB, Database",
"author": "SurrealDB",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/89/8d/101d3547bb1357089a381f94a07391c98c0b83f0040acf5037d6c1aa5b5f/surrealdb-1.0.2.tar.gz",
"platform": null,
"description": "<br>\n\n<p align=\"center\">\n\t<img width=120 src=\"https://raw.githubusercontent.com/surrealdb/icons/main/surreal.svg\" />\n\t \n\t<img width=120 src=\"https://raw.githubusercontent.com/surrealdb/icons/main/python.svg\" />\n</p>\n\n<h3 align=\"center\">The official SurrealDB SDK for Python.</h3>\n\n<br>\n\n<p align=\"center\">\n\t<a href=\"https://github.com/surrealdb/surrealdb.py\"><img src=\"https://img.shields.io/badge/status-stable-ff00bb.svg?style=flat-square\"></a>\n\t \n\t<a href=\"https://surrealdb.com/docs/integration/libraries/python\"><img src=\"https://img.shields.io/badge/docs-view-44cc11.svg?style=flat-square\"></a>\n\t \n\t<a href=\"https://pypi.org/project/surrealdb/\"><img src=\"https://img.shields.io/pypi/v/surrealdb?style=flat-square\"></a>\n \n <a href=\"https://pypi.org/project/surrealdb/\"><img src=\"https://img.shields.io/pypi/dm/surrealdb?style=flat-square\"></a> \n\t \n\t<a href=\"https://pypi.org/project/surrealdb/\"><img src=\"https://img.shields.io/pypi/pyversions/surrealdb?style=flat-square\"></a>\n</p>\n\n<p align=\"center\">\n\t<a href=\"https://surrealdb.com/discord\"><img src=\"https://img.shields.io/discord/902568124350599239?label=discord&style=flat-square&color=5a66f6\"></a>\n\t \n <a href=\"https://twitter.com/surrealdb\"><img src=\"https://img.shields.io/badge/twitter-follow_us-1d9bf0.svg?style=flat-square\"></a>\n \n <a href=\"https://www.linkedin.com/company/surrealdb/\"><img src=\"https://img.shields.io/badge/linkedin-connect_with_us-0a66c2.svg?style=flat-square\"></a>\n \n <a href=\"https://www.youtube.com/channel/UCjf2teVEuYVvvVC-gFZNq6w\"><img src=\"https://img.shields.io/badge/youtube-subscribe-fc1c1c.svg?style=flat-square\"></a>\n</p>\n\n# surrealdb.py\n\nThe official SurrealDB SDK for Python.\n\n## Documentation\n\nView the SDK documentation [here](https://surrealdb.com/docs/integration/libraries/python).\n\n## How to install\n\n```sh\npip install surrealdb\n```\n\n# Quick start\n\nIn this short guide, you will learn how to install, import, and initialize the SDK, as well as perform the basic data manipulation queries. \nThis guide uses the `Surreal` class, but this example would also work with `AsyncSurreal` class, with the addition of `await` in front of the class methods.\n\n\n## Install\n\n```sh\npip install surrealdb\n```\n\n## Learn the basics\n\n```python\n\n# Import the Surreal class\nfrom surrealdb import Surreal\n\n# Using a context manger to automatically connect and disconnect\nwith Surreal(\"ws://localhost:8000/rpc\") as db:\n db.signin({\"username\": 'root', \"password\": 'root'})\n db.use(\"namepace_test\", \"database_test\")\n\n # Create a record in the person table\n db.create(\n \"person\",\n {\n \"user\": \"me\",\n \"password\": \"safe\",\n \"marketing\": True,\n \"tags\": [\"python\", \"documentation\"],\n },\n )\n\n # Read all the records in the table\n print(db.select(\"person\"))\n\n # Update all records in the table\n print(db.update(\"person\", {\n \"user\":\"you\",\n \"password\":\"very_safe\",\n \"marketing\": False,\n \"tags\": [\"Awesome\"]\n }))\n\n # Delete all records in the table\n print(db.delete(\"person\"))\n\n # You can also use the query method \n # doing all of the above and more in SurrealQl\n \n # In SurrealQL you can do a direct insert \n # and the table will be created if it doesn't exist\n \n # Create\n db.query(\"\"\"\n insert into person {\n user: 'me',\n password: 'very_safe',\n tags: ['python', 'documentation']\n };\n \"\"\")\n\n # Read\n print(db.query(\"select * from person\"))\n \n # Update\n print(db.query(\"\"\"\n update person content {\n user: 'you',\n password: 'more_safe',\n tags: ['awesome']\n };\n \"\"\"))\n\n # Delete\n print(db.query(\"delete person\"))\n```\n\n## Next steps\n\nNow that you have learned the basics of the SurrealDB SDK for Python, you can learn more about the SDK and its methods [in the methods section](https://surrealdb.com/docs/sdk/python/methods) and [data types section](https://surrealdb.com/docs/sdk/python/data-types).\n## Contributing\nContributions to this library are welcome! If you encounter issues, have feature requests, or \nwant to make improvements, feel free to open issues or submit pull requests.\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "SurrealDB python client",
"version": "1.0.2",
"project_urls": {
"Homepage": "https://github.com/surrealdb/surrealdb.py"
},
"split_keywords": [
"surrealdb",
" database"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7e91d0f0b44354106fbea9be8bc7a93833a4ee21b07eb826f3b329cf442af2f9",
"md5": "cd40ab807e2bf25f6ed89e177845ae9f",
"sha256": "f55d9993d58d70dbbff272ab1e761ca1bd44622d1baaa209ec9208d0dd4f5e97"
},
"downloads": -1,
"filename": "surrealdb-1.0.2-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "cd40ab807e2bf25f6ed89e177845ae9f",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 40440,
"upload_time": "2025-02-02T00:56:03",
"upload_time_iso_8601": "2025-02-02T00:56:03.909598Z",
"url": "https://files.pythonhosted.org/packages/7e/91/d0f0b44354106fbea9be8bc7a93833a4ee21b07eb826f3b329cf442af2f9/surrealdb-1.0.2-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "898d101d3547bb1357089a381f94a07391c98c0b83f0040acf5037d6c1aa5b5f",
"md5": "611cf5cd7cb8f3fbfa4096ccab611803",
"sha256": "03341ac491c33083eff0dac9a8b70695c8e5c28219673786198ad529dee4791a"
},
"downloads": -1,
"filename": "surrealdb-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "611cf5cd7cb8f3fbfa4096ccab611803",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 27915,
"upload_time": "2025-02-02T00:56:07",
"upload_time_iso_8601": "2025-02-02T00:56:07.165795Z",
"url": "https://files.pythonhosted.org/packages/89/8d/101d3547bb1357089a381f94a07391c98c0b83f0040acf5037d6c1aa5b5f/surrealdb-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-02 00:56:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "surrealdb",
"github_project": "surrealdb.py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "aiohappyeyeballs",
"specs": [
[
"==",
"2.4.4"
]
]
},
{
"name": "aiohttp",
"specs": [
[
"==",
"3.11.11"
]
]
},
{
"name": "aiosignal",
"specs": [
[
"==",
"1.3.2"
]
]
},
{
"name": "async-timeout",
"specs": [
[
"==",
"5.0.1"
]
]
},
{
"name": "attrs",
"specs": [
[
"==",
"25.1.0"
]
]
},
{
"name": "cbor2",
"specs": [
[
"==",
"5.6.5"
]
]
},
{
"name": "Cerberus",
"specs": [
[
"==",
"1.3.7"
]
]
},
{
"name": "certifi",
"specs": [
[
"==",
"2024.12.14"
]
]
},
{
"name": "charset-normalizer",
"specs": [
[
"==",
"3.4.1"
]
]
},
{
"name": "frozenlist",
"specs": [
[
"==",
"1.5.0"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"3.10"
]
]
},
{
"name": "marshmallow",
"specs": [
[
"==",
"3.26.0"
]
]
},
{
"name": "multidict",
"specs": [
[
"==",
"6.1.0"
]
]
},
{
"name": "packaging",
"specs": [
[
"==",
"24.2"
]
]
},
{
"name": "propcache",
"specs": [
[
"==",
"0.2.1"
]
]
},
{
"name": "pytz",
"specs": [
[
"==",
"2024.2"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.32.3"
]
]
},
{
"name": "typing_extensions",
"specs": [
[
"==",
"4.12.2"
]
]
},
{
"name": "urllib3",
"specs": [
[
"==",
"2.3.0"
]
]
},
{
"name": "websockets",
"specs": [
[
"==",
"14.2"
]
]
},
{
"name": "yarl",
"specs": [
[
"==",
"1.18.3"
]
]
}
],
"lcname": "surrealdb"
}