{"id":13675802,"url":"https://github.com/localstack/verdin","last_synced_at":"2025-04-11T09:31:02.213Z","repository":{"id":43999407,"uuid":"410258231","full_name":"localstack/verdin","owner":"localstack","description":"A Tinybird SDK for Python 🐦","archived":false,"fork":false,"pushed_at":"2022-07-17T13:42:17.000Z","size":37,"stargazers_count":20,"open_issues_count":1,"forks_count":1,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-04-25T07:02:29.656Z","etag":null,"topics":["database-client","python","sdk","tinybird"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/localstack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-25T11:47:20.000Z","updated_at":"2024-04-25T07:02:29.657Z","dependencies_parsed_at":"2022-09-04T07:23:07.979Z","dependency_job_id":null,"html_url":"https://github.com/localstack/verdin","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/localstack%2Fverdin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack%2Fverdin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack%2Fverdin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack%2Fverdin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/localstack","download_url":"https://codeload.github.com/localstack/verdin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248368207,"owners_count":21092317,"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":["database-client","python","sdk","tinybird"],"created_at":"2024-08-02T12:01:03.653Z","updated_at":"2025-04-11T09:31:01.982Z","avatar_url":"https://github.com/localstack.png","language":"Python","readme":"Verdin\n======\n\n\u003cp\u003e\n  \u003ca href=\"https://pypi.org/project/verdin/\"\u003e\u003cimg alt=\"PyPI Version\" src=\"https://img.shields.io/pypi/v/verdin?color=blue\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/localstack/verdin/actions/workflows/build.yml\"\u003e\u003cimg alt=\"CI Status\" src=\"https://github.com/localstack/verdin/actions/workflows/build.yml/badge.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://coveralls.io/github/localstack/verdin?branch=master\"\u003e\u003cimg src=\"https://coveralls.io/repos/github/localstack/verdin/badge.svg?branch=master\" alt=\"Coverage Status\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://img.shields.io/pypi/l/verdin.svg\"\u003e\u003cimg alt=\"PyPI License\" src=\"https://img.shields.io/pypi/l/verdin.svg\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/psf/black\"\u003e\u003cimg alt=\"Code style: black\" src=\"https://img.shields.io/badge/code%20style-black-000000.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nVerdin is a [tiny bird](https://en.wikipedia.org/wiki/Verdin), and also a [Tinybird](https://tinybird.co) SDK for Python\n.\n\nInstall\n-------\n\n    pip install verdin\n\nRequirements\n------------\n\nPython 3.8+\n\nUsage\n-----\n\n### Run an SQL Query\n\n```python\n# the tinybird module exposes all important tinybird concepts\nfrom verdin import tinybird\n\nclient = tinybird.Client(\"p.mytoken\")\nquery = client.sql(\"select * from my_datasource__v0\")\n\n# run the query with `FORMAT JSON` and receive a QueryJsonResult\nresponse: tinybird.QueryJsonResult = query.json()\n\n# print records returned from the pipe\nprint(response.data)\n```\n\nYou can also run, e.g., `query.get(format=OutputFormat.CSV)` to get the raw response with CSV data. \n\n### Query a Pipe\n\n```python\nfrom verdin import tinybird\n\nclient = tinybird.Client(\"p.mytoken\")\npipe = client.pipe(\"my_pipe\")\n\n# query the pipe using dynamic parameters\nresponse: tinybird.PipeJsonResponse = pipe.query({\"key\": \"val\"})\n\n# print records returned from the pipe\nprint(response.data)\n```\n\n### Append to a DataSource\n\n```python\nfrom verdin import tinybird\n\nclient = tinybird.Client(\"p.mytoken\")\n\n# will access my_datasource__v0\ndatasource = client.datasource(\"my_datasource\", version=0)\n\n# query the pipe using dynamic parameters\ndatasource.append([\n    (\"col1-row1\", \"col2-row1\"),\n    (\"col1-row2\", \"col2-row2\"),\n])\n```\n\n### Queue and batch records into a DataSource\n\nVerdin provides a way to queue and batch data continuously:\n\n```python\nfrom queue import Queue\nfrom threading import Thread\n\nfrom verdin import tinybird\nfrom verdin.worker import QueuingDatasourceAppender\n\nclient = tinybird.Client(\"p.mytoken\")\n\nrecords = Queue()\n\nappender = QueuingDatasourceAppender(records, client.datasource(\"my_datasource\"))\nThread(target=appender.run).start()\n\n# appender will regularly read batches of data from the queue and append them\n# to the datasource. the appender respects rate limiting.\n\nrecords.put((\"col1-row1\", \"col2-row1\"))\nrecords.put((\"col1-row2\", \"col2-row2\"))\n```\n\nDevelop\n-------\n\nCreate the virtual environment, install dependencies, and run tests\n\n    make venv\n    make test\n\nRun the code formatter\n\n    make format\n\nUpload the pypi package using twine\n\n    make upload\n","funding_links":[],"categories":["SDKs \u0026 Utilities 🧰"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalstack%2Fverdin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocalstack%2Fverdin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalstack%2Fverdin/lists"}