{"id":22393588,"url":"https://github.com/gizmodata/ibis-gizmosql","last_synced_at":"2026-02-13T00:52:10.964Z","repository":{"id":257827287,"uuid":"873064232","full_name":"gizmodata/ibis-gizmosql","owner":"gizmodata","description":"An Ibis back-end for the GizmoSQL Arrow Flight SQL Server (with the DuckDB engine)","archived":false,"fork":false,"pushed_at":"2024-10-16T18:49:00.000Z","size":30,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-21T05:25:24.725Z","etag":null,"topics":["database","duckdb","gizmodata","gizmosql","ibis","python","sql"],"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/gizmodata.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-15T14:39:51.000Z","updated_at":"2024-11-01T14:37:03.000Z","dependencies_parsed_at":"2024-10-18T01:14:54.138Z","dependency_job_id":null,"html_url":"https://github.com/gizmodata/ibis-gizmosql","commit_stats":null,"previous_names":["gizmodata/ibis-gizmosql"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gizmodata%2Fibis-gizmosql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gizmodata%2Fibis-gizmosql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gizmodata%2Fibis-gizmosql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gizmodata%2Fibis-gizmosql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gizmodata","download_url":"https://codeload.github.com/gizmodata/ibis-gizmosql/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228236626,"owners_count":17889562,"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","duckdb","gizmodata","gizmosql","ibis","python","sql"],"created_at":"2024-12-05T05:06:29.797Z","updated_at":"2026-02-13T00:52:10.959Z","avatar_url":"https://github.com/gizmodata.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ibis-gizmosql\nAn [Ibis](https://ibis-project.org) back-end for [GizmoSQL](https://gizmodata.com/gizmosql)\n\n[\u003cimg src=\"https://img.shields.io/badge/GitHub-gizmodata%2Fibis--gizmosql-blue.svg?logo=Github\"\u003e](https://github.com/gizmodata/ibis-gizmosql)\n[\u003cimg src=\"https://img.shields.io/badge/GitHub-gizmodata%2Fgizmosql--public-blue.svg?logo=Github\"\u003e](https://github.com/gizmodata/gizmosql-public)\n[![ibis-gizmosql-ci](https://github.com/gizmodata/ibis-gizmosql/actions/workflows/ci.yml/badge.svg)](https://github.com/gizmodata/ibis-gizmosql/actions/workflows/ci.yml)\n[![Supported Python Versions](https://img.shields.io/pypi/pyversions/ibis-gizmosql)](https://pypi.org/project/ibis-gizmosql/)\n[![PyPI version](https://badge.fury.io/py/ibis-gizmosql.svg)](https://badge.fury.io/py/ibis-gizmosql)\n[![PyPI Downloads](https://img.shields.io/pypi/dm/ibis-gizmosql.svg)](https://pypi.org/project/ibis-gizmosql/)\n\n# Setup (to run locally)\n\n## Install Python package\nYou can install `ibis-gizmosql` from PyPi or from source.\n\n### Option 1 - from PyPi\n```shell\n# Create the virtual environment\npython3 -m venv .venv\n\n# Activate the virtual environment\n. .venv/bin/activate\n\npip install ibis-gizmosql\n```\n\n### Option 2 - from source - for development\n```shell\ngit clone https://github.com/gizmodata/ibis-gizmosql\n\ncd ibis-gizmosql\n\n# Create the virtual environment\npython3 -m venv .venv\n\n# Activate the virtual environment\n. .venv/bin/activate\n\n# Upgrade pip, setuptools, and wheel\npip install --upgrade pip setuptools wheel\n\n# Install the Ibis GizmoSQL back-end - in editable mode with client and dev dependencies\npip install --editable .[dev,test]\n```\n\n### Note\nFor the following commands - if you running from source and using `--editable` mode (for development purposes) - you will need to set the PYTHONPATH environment variable as follows:\n```shell\nexport PYTHONPATH=$(pwd)/ibis_gizmosql\n```\n\n### Usage\nIn this example - we'll start a GizmoSQL server with the DuckDB back-end in Docker, and connect to it from Python using Ibis.\n\nFirst - start the GizmoSQL server - which by default mounts an empty in-memory database.  We use the `INIT_SQL_COMMANDS` env var in the `docker` command to create a very small TPC-H database upon startup:\n\n```bash\ndocker run --name gizmosql \\\n           --detach \\\n           --rm \\\n           --tty \\\n           --init \\\n           --publish 31337:31337 \\\n           --env TLS_ENABLED=\"1\" \\\n           --env GIZMOSQL_PASSWORD=\"gizmosql_password\" \\\n           --env PRINT_QUERIES=\"1\" \\\n           --env DATABASE_FILENAME=\":memory:\" \\\n           --env INIT_SQL_COMMANDS=\"CALL dbgen(sf=0.01);\" \\\n           --pull always \\\n           gizmodata/gizmosql:latest\n```\n\n\u003e [!IMPORTANT]\n\u003e The GizmoSQL server must be started with the DuckDB (default) back-end.  The SQLite back-end is not supported.\n\nNext - connect to the GizmoSQL server from Python using Ibis by running this Python code:\n```python\nimport os\nimport ibis\nfrom ibis import _\n\n# Kwarg connection example\ncon = ibis.gizmosql.connect(host=\"localhost\",\n                            user=os.getenv(\"GIZMOSQL_USERNAME\", \"gizmosql_username\"),\n                            password=os.getenv(\"GIZMOSQL_PASSWORD\", \"gizmosql_password\"),\n                            port=31337,\n                            use_encryption=True,\n                            disable_certificate_verification=True\n                            )\n\n# URL connection example\n# con = ibis.connect(\"gizmosql://gizmosql_username:gizmosql_password@localhost:31337?disableCertificateVerification=True\u0026useEncryption=True\")\n\nprint(con.tables)\n\n# assign the LINEITEM table to variable t (an Ibis table object)\nt = con.table('lineitem')\n\n# use the Ibis dataframe API to run TPC-H query 1\nresults = (t.filter(_.l_shipdate.cast('date') \u003c= ibis.date('1998-12-01') + ibis.interval(days=90))\n       .mutate(discount_price=_.l_extendedprice * (1 - _.l_discount))\n       .mutate(charge=_.discount_price * (1 + _.l_tax))\n       .group_by([_.l_returnflag,\n                  _.l_linestatus\n                  ]\n                 )\n       .aggregate(\n            sum_qty=_.l_quantity.sum(),\n            sum_base_price=_.l_extendedprice.sum(),\n            sum_disc_price=_.discount_price.sum(),\n            sum_charge=_.charge.sum(),\n            avg_qty=_.l_quantity.mean(),\n            avg_price=_.l_extendedprice.mean(),\n            avg_disc=_.l_discount.mean(),\n            count_order=_.count()\n        )\n       .order_by([_.l_returnflag,\n                  _.l_linestatus\n                  ]\n                 )\n       )\n\nprint(results.execute())\n```\n\nYou should see output:\n```text\n  l_returnflag l_linestatus    sum_qty sum_base_price sum_disc_price     sum_charge avg_qty avg_price avg_disc  count_order\n0            A            F  380456.00   532348211.65   505822441.49   526165934.00   25.58  35785.71     0.05        14876\n1            N            F    8971.00    12384801.37    11798257.21    12282485.06   25.78  35588.51     0.05          348\n2            N            O  765251.00  1072862302.10  1019517788.99  1060424708.62   25.47  35703.76     0.05        30049\n3            R            F  381449.00   534594445.35   507996454.41   528524219.36   25.60  35874.01     0.05        14902\n```\n\n### Handy development commands\n\n#### Version management\n\n##### Bump the version of the application - (you must have installed from source with the [dev] extras)\n```bash\nbumpver update --patch\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgizmodata%2Fibis-gizmosql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgizmodata%2Fibis-gizmosql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgizmodata%2Fibis-gizmosql/lists"}