# 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",
> secure=True,
> 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/e0/cd/608fc99d47bb0251650a136b0809d209d64687b08f6183186fd8d6ebde77/databend-py-0.6.2.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> secure=True,\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.6.2",
"project_urls": {
"Homepage": "https://github.com/databendcloud/databend-py"
},
"split_keywords": [
"databend",
"db",
"database",
"cloud",
"analytics"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fb73b39b5a2b3a6a291c47900789a35a5cce7faab2e64330fe03bf977534b357",
"md5": "2722a62b40f6b1bd8daa36098e4f6869",
"sha256": "181e0237481622a969c27762d71ca69f5562bc60b1d96ebb78605fbb26d535cd"
},
"downloads": -1,
"filename": "databend_py-0.6.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2722a62b40f6b1bd8daa36098e4f6869",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.4",
"size": 20909,
"upload_time": "2024-08-08T03:01:37",
"upload_time_iso_8601": "2024-08-08T03:01:37.022895Z",
"url": "https://files.pythonhosted.org/packages/fb/73/b39b5a2b3a6a291c47900789a35a5cce7faab2e64330fe03bf977534b357/databend_py-0.6.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e0cd608fc99d47bb0251650a136b0809d209d64687b08f6183186fd8d6ebde77",
"md5": "00eeae3125266a184342bfce92885de0",
"sha256": "ccfa1fa31e7a715869679dfe8e18d375668d5e442271496a884bd61ddca8e724"
},
"downloads": -1,
"filename": "databend-py-0.6.2.tar.gz",
"has_sig": false,
"md5_digest": "00eeae3125266a184342bfce92885de0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.4",
"size": 18978,
"upload_time": "2024-08-08T03:01:39",
"upload_time_iso_8601": "2024-08-08T03:01:39.205345Z",
"url": "https://files.pythonhosted.org/packages/e0/cd/608fc99d47bb0251650a136b0809d209d64687b08f6183186fd8d6ebde77/databend-py-0.6.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-08 03:01:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "databendcloud",
"github_project": "databend-py",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [
{
"name": "environs",
"specs": [
[
"==",
"9.5.0"
]
]
},
{
"name": "pytz",
"specs": [
[
"==",
"2022.5"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.28.1"
]
]
},
{
"name": "setuptools",
"specs": [
[
"==",
"62.3.2"
]
]
},
{
"name": "black",
"specs": [
[
"==",
"23.3.0"
]
]
},
{
"name": "pyflakes",
"specs": [
[
"==",
"3.0.1"
]
]
}
],
"lcname": "databend-py"
}