surrealdb


Namesurrealdb JSON
Version 0.3.1 PyPI version JSON
download
home_pagehttps://github.com/surrealdb/surrealdb.py
SummaryThe official SurrealDB library for Python.
upload_time2023-04-21 09:05:37
maintainer
docs_urlNone
authorSurrealDB
requires_python>=3.7,<4.0
licenseApache-2.0
keywords surrealdb database
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <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. &nbsp; Build faster. &nbsp; 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>
    &nbsp;
    <a href="https://surrealdb.com/docs/integration/libraries/python"><img src="https://img.shields.io/badge/docs-view-44cc11.svg?style=flat-square"></a>
    &nbsp;
    <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>
    &nbsp;
    <a href="https://twitter.com/surrealdb"><img src="https://img.shields.io/badge/twitter-follow_us-1d9bf0.svg?style=flat-square"></a>
    &nbsp;
    <a href="https://dev.to/surrealdb"><img src="https://img.shields.io/badge/dev-join_us-86f7b7.svg?style=flat-square"></a>
    &nbsp;
    <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>
	&nbsp;
	<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>
	&nbsp;
    <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>
    &nbsp;
    <a href="https://twitter.com/surrealdb"><img height="25" src="https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/social/twitter.svg" alt="Twitter"></a>
    &nbsp;
    <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>
    &nbsp;
    <a href="https://dev.to/surrealdb"><img height="25" src="https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/social/dev.svg" alt="Dev"></a>
    &nbsp;
    <a href="https://surrealdb.com/discord"><img height="25" src="https://raw.githubusercontent.com/surrealdb/surrealdb/main/img/social/discord.svg" alt="Discord"></a>
    &nbsp;
    <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": "surrealdb",
    "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/7e/e0/550b6815fd5dbfce557c4d92431395ed795eda533556cd161371e383835a/surrealdb-0.3.1.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. &nbsp; Build faster. &nbsp; 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    &nbsp;\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    &nbsp;\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    &nbsp;\n    <a href=\"https://twitter.com/surrealdb\"><img src=\"https://img.shields.io/badge/twitter-follow_us-1d9bf0.svg?style=flat-square\"></a>\n    &nbsp;\n    <a href=\"https://dev.to/surrealdb\"><img src=\"https://img.shields.io/badge/dev-join_us-86f7b7.svg?style=flat-square\"></a>\n    &nbsp;\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&nbsp;\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&nbsp;\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    &nbsp;\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    &nbsp;\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    &nbsp;\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    &nbsp;\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    &nbsp;\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 official SurrealDB library for Python.",
    "version": "0.3.1",
    "split_keywords": [
        "surrealdb",
        "database"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "08b0634f23ba18b2043a70855a398dee7553e55436e7816e023045c95a7e0c64",
                "md5": "0a36c30fe04a3b728c6bc7e8b65c4897",
                "sha256": "633269a7064067d264ac1c429386e12a399e344bd74917dfa471318e1dc8995a"
            },
            "downloads": -1,
            "filename": "surrealdb-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0a36c30fe04a3b728c6bc7e8b65c4897",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 14776,
            "upload_time": "2023-04-21T09:05:35",
            "upload_time_iso_8601": "2023-04-21T09:05:35.312721Z",
            "url": "https://files.pythonhosted.org/packages/08/b0/634f23ba18b2043a70855a398dee7553e55436e7816e023045c95a7e0c64/surrealdb-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7ee0550b6815fd5dbfce557c4d92431395ed795eda533556cd161371e383835a",
                "md5": "f679df0ef57938065e8d13bd32aee3e4",
                "sha256": "3c8a458de38e3c6314b4472c4353cfc5b65077073a723942a4a90114b872376e"
            },
            "downloads": -1,
            "filename": "surrealdb-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f679df0ef57938065e8d13bd32aee3e4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 13469,
            "upload_time": "2023-04-21T09:05:37",
            "upload_time_iso_8601": "2023-04-21T09:05:37.531443Z",
            "url": "https://files.pythonhosted.org/packages/7e/e0/550b6815fd5dbfce557c4d92431395ed795eda533556cd161371e383835a/surrealdb-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-21 09:05:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "surrealdb",
    "github_project": "surrealdb.py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "surrealdb"
}
        
Elapsed time: 0.14492s