<p align="center">
<img width="300" src="https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/icon.png" alt="SurrealDB Icon">
</p>
<br>
<p align="center">
<a href="https://surrealdb.com#gh-dark-mode-only" target="_blank">
<img width="300" src="https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/white/logo.svg" alt="SurrealDB Logo">
</a>
<a href="https://surrealdb.com#gh-light-mode-only" target="_blank">
<img width="300" src="https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/black/logo.svg" alt="SurrealDB Logo">
</a>
</p>
<h3 align="center">
<a href="https://surrealdb.com#gh-dark-mode-only" target="_blank">
<img src="https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/white/text.svg" height="15" alt="SurrealDB">
</a>
<a href="https://surrealdb.com#gh-light-mode-only" target="_blank">
<img src="https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/black/text.svg" height="15" alt="SurrealDB">
</a>
is the ultimate cloud <br> database for tomorrow's applications
</h3>
<h3 align="center">Develop easier. Build faster. Scale quicker.</h3>
<br>
<p align="center">
<a href="https://github.com/surrealdb/surrealdb.py"><img src="https://img.shields.io/badge/status-beta-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://github.com/surrealdb/surrealdb.py"><img src="https://img.shields.io/badge/license-Apache_License_2.0-00bfff.svg?style=flat-square"></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://dev.to/surrealdb"><img src="https://img.shields.io/badge/dev-join_us-86f7b7.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>
</p>
<p align="center">
<a href="https://surrealdb.com/blog"><img height="25" src="https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/social/blog.svg" alt="Blog"></a>
<a href="https://github.com/surrealdb/surrealdb"><img height="25" src="https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/social/github.svg" alt="Github "></a>
<a href="https://www.linkedin.com/company/surrealdb/"><img height="25" src="https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/social/linkedin.svg" alt="LinkedIn"></a>
<a href="https://twitter.com/surrealdb"><img height="25" src="https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/social/twitter.svg" alt="Twitter"></a>
<a href="https://www.youtube.com/channel/UCjf2teVEuYVvvVC-gFZNq6w"><img height="25" src="https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/social/youtube.svg" alt="Youtube"></a>
<a href="https://dev.to/surrealdb"><img height="25" src="https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/social/dev.svg" alt="Dev"></a>
<a href="https://surrealdb.com/discord"><img height="25" src="https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/social/discord.svg" alt="Discord"></a>
<a href="https://stackoverflow.com/questions/tagged/surrealdb"><img height="25" src="https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/social/stack-overflow.svg" alt="StackOverflow"></a>
</p>
# surrealdb.py
The official SurrealDB library for Python.
[See the documentation here](https://surrealdb.com/docs/integration/libraries/python)
## Getting Started
First install [SurrealDB](https://surrealdb.com/docs/start/installation) if you haven't already.
### Install the python library
```
pip install surrealdb
```
Alternatively, you can use install it using [Poetry](https://python-poetry.org/)
```python
from surrealdb import Surreal
async def main():
"""Example of how to use the SurrealDB client."""
async with Surreal("ws://localhost:8000/rpc") as db:
await db.signin({"user": "root", "pass": "root"})
await db.use("test", "test")
await db.create(
"person",
{
"user": "me",
"pass": "safe",
"marketing": True,
"tags": ["python", "documentation"],
},
)
print(await db.select("person"))
print(await db.update("person", {
"user":"you",
"pass":"very_safe",
"marketing": False,
"tags": ["Awesome"]
}))
print(await 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
await db.query("""
insert into person {
user: 'me',
pass: 'very_safe',
tags: ['python', 'documentation']
};
""")
print(await db.query("select * from person"))
print(await db.query("""
update person content {
user: 'you',
pass: 'more_safe',
tags: ['awesome']
};
"""))
print(await db.query("delete person"))
if __name__ == "__main__":
import asyncio
asyncio.run(main())
```
Raw data
{
"_id": null,
"home_page": "https://github.com/surrealdb/surrealdb.py",
"name": "surrealdb2",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "SurrealDB,Database",
"author": "SurrealDB",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/39/54/88edf3f0ae1499010495271e56a09b858b4f608c48c315701b695c08d2c5/surrealdb2-0.3.2.tar.gz",
"platform": null,
"description": "<p align=\"center\">\n <img width=\"300\" src=\"https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/icon.png\" alt=\"SurrealDB Icon\">\n</p>\n\n<br>\n\n<p align=\"center\">\n <a href=\"https://surrealdb.com#gh-dark-mode-only\" target=\"_blank\">\n <img width=\"300\" src=\"https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/white/logo.svg\" alt=\"SurrealDB Logo\">\n </a>\n <a href=\"https://surrealdb.com#gh-light-mode-only\" target=\"_blank\">\n <img width=\"300\" src=\"https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/black/logo.svg\" alt=\"SurrealDB Logo\">\n </a>\n</p>\n\n<h3 align=\"center\">\n <a href=\"https://surrealdb.com#gh-dark-mode-only\" target=\"_blank\">\n <img src=\"https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/white/text.svg\" height=\"15\" alt=\"SurrealDB\">\n </a>\n <a href=\"https://surrealdb.com#gh-light-mode-only\" target=\"_blank\">\n <img src=\"https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/black/text.svg\" height=\"15\" alt=\"SurrealDB\">\n </a>\n is the ultimate cloud <br> database for tomorrow's applications\n</h3>\n\n<h3 align=\"center\">Develop easier. Build faster. Scale quicker.</h3>\n\n<br>\n\n<p align=\"center\">\n <a href=\"https://github.com/surrealdb/surrealdb.py\"><img src=\"https://img.shields.io/badge/status-beta-ff00bb.svg?style=flat-square\"></a>\n \n <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 \n <a href=\"https://github.com/surrealdb/surrealdb.py\"><img src=\"https://img.shields.io/badge/license-Apache_License_2.0-00bfff.svg?style=flat-square\"></a>\n \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://dev.to/surrealdb\"><img src=\"https://img.shields.io/badge/dev-join_us-86f7b7.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</p>\n\n<p align=\"center\">\n\t<a href=\"https://surrealdb.com/blog\"><img height=\"25\" src=\"https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/social/blog.svg\" alt=\"Blog\"></a>\n\t \n\t<a href=\"https://github.com/surrealdb/surrealdb\"><img height=\"25\" src=\"https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/social/github.svg\" alt=\"Github\t\"></a>\n\t \n <a href=\"https://www.linkedin.com/company/surrealdb/\"><img height=\"25\" src=\"https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/social/linkedin.svg\" alt=\"LinkedIn\"></a>\n \n <a href=\"https://twitter.com/surrealdb\"><img height=\"25\" src=\"https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/social/twitter.svg\" alt=\"Twitter\"></a>\n \n <a href=\"https://www.youtube.com/channel/UCjf2teVEuYVvvVC-gFZNq6w\"><img height=\"25\" src=\"https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/social/youtube.svg\" alt=\"Youtube\"></a>\n \n <a href=\"https://dev.to/surrealdb\"><img height=\"25\" src=\"https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/social/dev.svg\" alt=\"Dev\"></a>\n \n <a href=\"https://surrealdb.com/discord\"><img height=\"25\" src=\"https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/social/discord.svg\" alt=\"Discord\"></a>\n \n <a href=\"https://stackoverflow.com/questions/tagged/surrealdb\"><img height=\"25\" src=\"https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/social/stack-overflow.svg\" alt=\"StackOverflow\"></a>\n\n</p>\n\n# surrealdb.py\n\nThe official SurrealDB library for Python.\n\n[See the documentation here](https://surrealdb.com/docs/integration/libraries/python) \n\n## Getting Started\n\nFirst install [SurrealDB](https://surrealdb.com/docs/start/installation) if you haven't already.\n\n### Install the python library\n```\npip install surrealdb\n```\n\nAlternatively, you can use install it using [Poetry](https://python-poetry.org/)\n\n```python\nfrom surrealdb import Surreal\n\nasync def main():\n \"\"\"Example of how to use the SurrealDB client.\"\"\"\n async with Surreal(\"ws://localhost:8000/rpc\") as db:\n await db.signin({\"user\": \"root\", \"pass\": \"root\"})\n await db.use(\"test\", \"test\")\n await db.create(\n \"person\",\n {\n \"user\": \"me\",\n \"pass\": \"safe\",\n \"marketing\": True,\n \"tags\": [\"python\", \"documentation\"],\n },\n )\n print(await db.select(\"person\"))\n print(await db.update(\"person\", {\n \"user\":\"you\",\n \"pass\":\"very_safe\",\n \"marketing\": False,\n \"tags\": [\"Awesome\"]\n }))\n print(await 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 await db.query(\"\"\"\n insert into person {\n user: 'me',\n pass: 'very_safe',\n tags: ['python', 'documentation']\n };\n \n \"\"\")\n print(await db.query(\"select * from person\"))\n \n print(await db.query(\"\"\"\n update person content {\n user: 'you',\n pass: 'more_safe',\n tags: ['awesome']\n };\n \n \"\"\"))\n print(await db.query(\"delete person\"))\n\nif __name__ == \"__main__\":\n import asyncio\n\n asyncio.run(main())\n```",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "The unofficial SurrealDB library for Python, now working with Pydantic v2.0",
"version": "0.3.2",
"project_urls": {
"Documentation": "https://surrealdb.com/docs/integration/libraries/python",
"Homepage": "https://github.com/surrealdb/surrealdb.py",
"Repository": "https://github.com/surrealdb/surrealdb.py"
},
"split_keywords": [
"surrealdb",
"database"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "da676692b92dd2f71ae5eb0937d05685e6ced257f26f9324ebb1678b1fe41635",
"md5": "3fa5cdc43f5501a9c51d0625058553b3",
"sha256": "0c11697824f39b59964f7050a7f21b2c6e561d8c9e56b65043002e38b3c6aa44"
},
"downloads": -1,
"filename": "surrealdb2-0.3.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3fa5cdc43f5501a9c51d0625058553b3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 14610,
"upload_time": "2023-11-09T13:00:55",
"upload_time_iso_8601": "2023-11-09T13:00:55.538776Z",
"url": "https://files.pythonhosted.org/packages/da/67/6692b92dd2f71ae5eb0937d05685e6ced257f26f9324ebb1678b1fe41635/surrealdb2-0.3.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "395488edf3f0ae1499010495271e56a09b858b4f608c48c315701b695c08d2c5",
"md5": "bd0789cee8e2615efc383650d0db6e78",
"sha256": "cf7cced60654059cfc73e1f82a242bf2323b70aa00eaa19fa6f2774631908c44"
},
"downloads": -1,
"filename": "surrealdb2-0.3.2.tar.gz",
"has_sig": false,
"md5_digest": "bd0789cee8e2615efc383650d0db6e78",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 13355,
"upload_time": "2023-11-09T13:00:57",
"upload_time_iso_8601": "2023-11-09T13:00:57.418102Z",
"url": "https://files.pythonhosted.org/packages/39/54/88edf3f0ae1499010495271e56a09b858b4f608c48c315701b695c08d2c5/surrealdb2-0.3.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-09 13:00:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "surrealdb",
"github_project": "surrealdb.py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "surrealdb2"
}