# databend-py
Databend Cloud Python Driver with native http interface support
[![image](https://img.shields.io/pypi/v/databend-py.svg)](https://pypi.org/project/databend-py)
[![image](https://coveralls.io/repos/github/databendcloud/databend-py/badge.svg?branch=master)](https://coveralls.io/github/databendcloud/databend-py?branch=master)
[![image](https://img.shields.io/pypi/l/databend-py.svg)](https://pypi.org/project/databend-py)
[![image](https://img.shields.io/pypi/pyversions/databend-py.svg)](https://pypi.org/project/databend-py)
# Installation
pip install databend-py
# Usage
Use the next code to check connection:
> ``` python
> >>> from databend_py import Client
> >>> client = Client(
> host='tenant--warehouse.ch.datafusecloud.com',
> database="default",
> user="user",
> port="443",
> password="password",settings={"copy_purge":True,"force":True})
> >>> print(client.execute("SELECT 1"))
> ```
The [host]{.title-ref}, [user]{.title-ref}, [password]{.title-ref} info
will be found in databend cloud warehouse connect page as flows:
Pure Client example:
> ``` python
> >>> from databend_py import Client
> >>>
> >>> client = Client.from_url('http://root@localhost:8000/db?secure=False©_purge=True')
> >>>
> >>> client.execute('SHOW TABLES')
> [[], [('test',)]]
> >>> client.execute("show tables",with_column_types=True)
> [[('Tables_in_default', 'String')], [('test',)]] # [[(column_name, column_type)], [(data,)]]
> >>> client.execute('DROP TABLE IF EXISTS test')
> []
> >>> client.execute('CREATE TABLE test (x Int32)')
> []
> >>> client.execute(
> ... 'INSERT INTO test (x) VALUES', [(1,)]
> ... )
> 1
> >>> client.execute('INSERT INTO test (x) VALUES', [(200,)])
> 1
> ```
More usages examples find [here](./examples).
# Features
- Basic SQL.
- TLS support.
- Query settings.
- Types support:
- Float32/64
- \[U\]Int8/16/32/64/128/256
- Date/Date32/DateTime(\'timezone\')/DateTime64(\'timezone\')
- String
- Array(T)
- Nullable(T)
- Bool
# Compatibility
- If databend version \>= v0.9.0 or later, you need to use databend-py
version \>= v0.3.0.
# License
Databend Python Driver is distributed under the [Apache
license]{.title-ref}.
Raw data
{
"_id": null,
"home_page": "https://github.com/databendcloud/databend-py",
"name": "databend-py",
"maintainer": null,
"docs_url": null,
"requires_python": "<4,>=3.4",
"maintainer_email": null,
"keywords": "databend db database cloud analytics",
"author": "Databend Cloud Team",
"author_email": "hantmac@outlook.com",
"download_url": "https://files.pythonhosted.org/packages/83/e2/1550845b83aa069ca6c0766446055c5d85a394a0071902443f1cb83c405f/databend-py-0.5.9.tar.gz",
"platform": null,
"description": "# databend-py\n\nDatabend Cloud Python Driver with native http interface support\n\n[![image](https://img.shields.io/pypi/v/databend-py.svg)](https://pypi.org/project/databend-py)\n\n[![image](https://coveralls.io/repos/github/databendcloud/databend-py/badge.svg?branch=master)](https://coveralls.io/github/databendcloud/databend-py?branch=master)\n\n[![image](https://img.shields.io/pypi/l/databend-py.svg)](https://pypi.org/project/databend-py)\n\n[![image](https://img.shields.io/pypi/pyversions/databend-py.svg)](https://pypi.org/project/databend-py)\n\n# Installation\n\npip install databend-py\n\n# Usage\n\nUse the next code to check connection:\n\n> ``` python\n> >>> from databend_py import Client\n> >>> client = Client(\n> host='tenant--warehouse.ch.datafusecloud.com',\n> database=\"default\",\n> user=\"user\",\n> port=\"443\",\n> password=\"password\",settings={\"copy_purge\":True,\"force\":True})\n> >>> print(client.execute(\"SELECT 1\"))\n> ```\n\nThe [host]{.title-ref}, [user]{.title-ref}, [password]{.title-ref} info\nwill be found in databend cloud warehouse connect page as flows:\n\nPure Client example:\n\n> ``` python\n> >>> from databend_py import Client\n> >>>\n> >>> client = Client.from_url('http://root@localhost:8000/db?secure=False©_purge=True')\n> >>>\n> >>> client.execute('SHOW TABLES')\n> [[], [('test',)]]\n> >>> client.execute(\"show tables\",with_column_types=True)\n> [[('Tables_in_default', 'String')], [('test',)]] # [[(column_name, column_type)], [(data,)]]\n> >>> client.execute('DROP TABLE IF EXISTS test')\n> []\n> >>> client.execute('CREATE TABLE test (x Int32)')\n> []\n> >>> client.execute(\n> ... 'INSERT INTO test (x) VALUES', [(1,)]\n> ... )\n> 1\n> >>> client.execute('INSERT INTO test (x) VALUES', [(200,)])\n> 1\n> ```\n\nMore usages examples find [here](./examples).\n\n# Features\n\n- Basic SQL.\n- TLS support.\n- Query settings.\n- Types support:\n - Float32/64\n - \\[U\\]Int8/16/32/64/128/256\n - Date/Date32/DateTime(\\'timezone\\')/DateTime64(\\'timezone\\')\n - String\n - Array(T)\n - Nullable(T)\n - Bool\n\n# Compatibility\n\n- If databend version \\>= v0.9.0 or later, you need to use databend-py\n version \\>= v0.3.0.\n\n# License\n\nDatabend Python Driver is distributed under the [Apache\nlicense]{.title-ref}.\n\n\n",
"bugtrack_url": null,
"license": "Apache License",
"summary": "Python driver with native interface for Databend",
"version": "0.5.9",
"project_urls": {
"Homepage": "https://github.com/databendcloud/databend-py"
},
"split_keywords": [
"databend",
"db",
"database",
"cloud",
"analytics"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d7baeb1366b9585954a196a7246b0be9104f90fed3fe6c861f9dd60537a449d9",
"md5": "7789fd5dd864bc335f54b134d59f4525",
"sha256": "763cf16e281f3f51c1a3f4b1ccc5c2baec6044af0ff243750b632ab37ad1e406"
},
"downloads": -1,
"filename": "databend_py-0.5.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7789fd5dd864bc335f54b134d59f4525",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.4",
"size": 20802,
"upload_time": "2024-04-26T08:22:17",
"upload_time_iso_8601": "2024-04-26T08:22:17.446065Z",
"url": "https://files.pythonhosted.org/packages/d7/ba/eb1366b9585954a196a7246b0be9104f90fed3fe6c861f9dd60537a449d9/databend_py-0.5.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "83e21550845b83aa069ca6c0766446055c5d85a394a0071902443f1cb83c405f",
"md5": "7d9063c3e52eb39cf85f3fb147522df1",
"sha256": "9127cc667aa03f0e7e44715d35af33e14fe8de42c8ecb3b112fdef4ddfc28358"
},
"downloads": -1,
"filename": "databend-py-0.5.9.tar.gz",
"has_sig": false,
"md5_digest": "7d9063c3e52eb39cf85f3fb147522df1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.4",
"size": 18836,
"upload_time": "2024-04-26T08:22:19",
"upload_time_iso_8601": "2024-04-26T08:22:19.288865Z",
"url": "https://files.pythonhosted.org/packages/83/e2/1550845b83aa069ca6c0766446055c5d85a394a0071902443f1cb83c405f/databend-py-0.5.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-26 08:22:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "databendcloud",
"github_project": "databend-py",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [],
"lcname": "databend-py"
}