{"id":16544177,"url":"https://github.com/codemation/aiopyql-rpc-endpoint","last_synced_at":"2025-06-30T23:37:51.794Z","repository":{"id":39831435,"uuid":"314221094","full_name":"codemation/aiopyql-rpc-endpoint","owner":"codemation","description":"Template for deploying an EasyRpcServer in front of an aiopyql conncted database","archived":false,"fork":false,"pushed_at":"2020-12-18T22:53:21.000Z","size":26,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-14T11:16:51.892Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codemation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-19T11:02:34.000Z","updated_at":"2023-03-19T01:57:17.000Z","dependencies_parsed_at":"2022-09-13T07:24:55.272Z","dependency_job_id":null,"html_url":"https://github.com/codemation/aiopyql-rpc-endpoint","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemation%2Faiopyql-rpc-endpoint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemation%2Faiopyql-rpc-endpoint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemation%2Faiopyql-rpc-endpoint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemation%2Faiopyql-rpc-endpoint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codemation","download_url":"https://codeload.github.com/codemation/aiopyql-rpc-endpoint/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241801256,"owners_count":20022390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T19:01:15.872Z","updated_at":"2025-03-04T07:14:24.088Z","avatar_url":"https://github.com/codemation.png","language":"Python","readme":"# aiopyql-rpc-endpoint\nTemplate for deploying an EasyRpcServer in front of an aiopyql conncted database\n\n## Key Features\n- Quickly depoy and share an aiopyql database connection \n- Shared Database Cache\n\n## Env\n| ENV Variable | Values | Required? |\n|--------------|--------|-----------|\n| DB_TYPE | 'sqlite', 'mysql', 'postgres' | yes |\n| DB_NAME | 'database-name' | yes |\n| RPC_SECRET | 'abcd1234' | yes |\n| DB_USER | \"database-user' | yes - mysql / postgres |\n| DB_PASSWORD | 'abcd1234' | yes - mysql / postgres |\n| DB_HOST | 'localhost', '0.0.0.0', '192.168.1.1' | yes - mysql / postgres |\n| DB_PORT | defaults: 3304 - mysql, 5432 - postgres | yes - yes - mysql / postgres |\n| RPC_PATH | '/special-db-path' '/generic' '/ws/nested' | no - defaults to '/ws/DB_NAME' |\n| RPC_DEBUG | 'True', 'False' | no - 'False' if unspecified |\n\n# Quick Start - Sqlite\n\n    $ docker run -d --name aiopyql-testdb \\\n        -p 8590:8190 \\\n        -e DB_TYPE='sqlite' \\\n        -e DB_NAME='testdb' \\\n        -e RPC_SECRET='abcd1234' \\\n        -v dbtest:/mnt/pyql-db-endpoint \\\n        joshjamison/aiopyql-rpc-endpoint:latest\n\n# Quick Start - MySql\n\n    $ docker run -d --name aiopyql-testdb \\\n        -p 8590:8190 \\\n        -e DB_TYPE='mysql' \\\n        -e DB_NAME='testdb' \\\n        -e DB_USER='mysql_user' \\\n        -e DB_HOST='127.0.0.1' \\ \n        -e DB_PORT=3304 \\\n        -e DB_PASSWORD='abcd1234' \\\n        -e RPC_SECRET='abcd1234' \\\n        joshjamison/aiopyql-rpc-endpoint:latest\n\n# Quick Start - Postgres\n\n    # Deploy a test Postgres Container\n\n    $ mkdir pg_data\n\n    $ docker run --name pgtest -d \\ \n        -e POSTGRES_PASSWORD=abcd1234 \\\n        -e POSTGRES_DB=postgres_db \\\n        -p 5432:5432 \\\n        -v $(pwd)/pg_data:/var/lib/postgresql/data \\\n        postgres:latest\n\n\n    $ docker run -d --name aiopyql-pg-testdb \\\n        -p 8590:8190 \\\n        -e DB_TYPE='postgres' \\\n        -e DB_NAME='postgres_db' \\\n        -e DB_USER='postgres' \\\n        -e DB_HOST='localhost' \\\n        -e DB_PORT=5432 \\\n        -e DB_PASSWORD='abcd1234' \\\n        -e RPC_SECRET='abcd1234' \\\n        joshjamison/aiopyql-rpc-endpoint:latest\n\n# Shared Functions\nConnected proxies will have access to aiopyql Database \u0026 Table methods\n\n### Database Methods\n- create_table: aiopyql method for creating new tables\n- show_tables: list existing table names\n- run: run a database query, results are unformatted\n\n\u003cbr\u003e\n\n### Table methods: \u003cbr\u003e\n\nFor each table, the following methods exists within the EasyProxy \n\n    proxy['namespace'][f'{table}_{method}']\n\nMethods\n- insert \n- update \n- delete\n- select\n- set_item - quick insert / update \n- get_item - allows bracket index usage on EasyRpcProxyDatabase instance\n- get_schema \n\nUsage for each function can be found in [aiopyql](https://github.com/codemation/aiopyql)\n\n\n# Example: Accessing the Endpoint\n\n    import asyncio\n    from easyrpc.tools.database import EasyRpcProxyDatabase\n\n    async def main():\n\n        db = await EasyRpcProxyDatabase.create(\n            'localhost', \n            8190, \n            '/ws/testdb', \n            server_secret='abcd1234',\n            namespace='testdb'\n        )\n\u003cbr\u003e\n\n        create_table_result = await db.create_table(\n            'keystore',\n            [\n                ['key', 'str', 'UNIQUE NOT NULL'],\n                ['value', 'str']\n            ],\n            prim_key='key',\n            cache_enabled=True\n        )\n        print(f\"create_table_result: {create_table_result}\")\n\u003cbr\u003e\n\n        show_tables = await db.show_tables()\n\n        print(f\"show tables: {show_tables}\")\n\u003cbr\u003e\n\n        query = 'select * from sqlite_master'\n        run_query = await db.run(query)\n\n        print(f\"run_query results: {run_query}\")\n\u003cbr\u003e\n\n        keystore = db.tables['keystore']\n\n\u003cbr\u003e\n\n        # insert\n        await keystore.insert(\n            **{'key': 'new_key', 'value': 'new_value'}\n        )\n\u003cbr\u003e\n\n        # update\n        await keystore.update(\n            value='updated_value',\n            where={'key': 'new_key'}\n        )\n\u003cbr\u003e\n\n        # delete\n        await keystore.delete( \n            where={'key': 'new_key'}\n        )\n\u003cbr\u003e\n\n        # select\n        selection = await keystore.select( \n            '*',\n            where={'key': 'new_key'}\n        )\n        print(f\"selection: {selection}\")\n\u003cbr\u003e\n\n    asyncio.run(main())\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemation%2Faiopyql-rpc-endpoint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodemation%2Faiopyql-rpc-endpoint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemation%2Faiopyql-rpc-endpoint/lists"}