From 883b2ea6082659fa9214b81bb208c488ca454187 Mon Sep 17 00:00:00 2001 From: Sayan Nandan Date: Thu, 2 May 2024 02:07:24 +0530 Subject: [PATCH] version: 0.1.1 Additionally, the README was updated --- README.md | 26 +++++++++++++++++++++----- pyproject.toml | 2 +- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c5026c1..bde4bd4 100644 --- a/README.md +++ b/README.md @@ -16,15 +16,31 @@ pip install skytable-py Use in your code: ```python import asyncio -from skytable_py import Config +from skytable_py import Config, Query -c = Config(username="root", password="password") +c = Config("root", "mypassword123456789") -async def main(): - db = await c.connect() - # ... use the db +async def main(): + db = None + try: + db = await c.connect() + # init space + assert (await db.run_simple_query(Query("create space apps"))).is_empty() + # init model + assert (await db.run_simple_query(Query("create model apps.auth(username: string, password: string)"))).is_empty() + # insert our test row + assert (await db.run_simple_query(Query("insert into apps.auth(?, ?)", "sayan", "mypassword"))).is_empty() + # fetch data + username, password = (await db.run_simple_query(Query("select * from apps.auth where username = ?", "sayan"))).row().columns + # output + print(f"username={username.string()}, password={password.string()}") + except Exception as e: + print(f"failed with error {e}") + finally: + if db: + await db.close() if __name__ == "__main__": asyncio.run(main()) diff --git a/pyproject.toml b/pyproject.toml index 99432c1..535a282 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "skytable-py" -version = "0.1.0" +version = "0.1.1" authors = [{ name = "Sayan Nandan", email = "nandansayan@outlook.com" }] description = "Official Skytable client library for Python" readme = "README.md"