diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-05-05 08:31:23 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-05-05 08:31:23 +0000 |
| commit | 2fddae0e7bd964808933535b1d82715dcb06c1ea (patch) | |
| tree | 20f341cd120cc7409c53c44b3330a2b8e8100f5e | |
| parent | c9ac6a3e077a0ede55a08009f497b2d87e4154ce (diff) | |
automatic import of python-clicksqlopeneuler20.03
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-clicksql.spec | 423 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 425 insertions, 0 deletions
@@ -0,0 +1 @@ +/ClickSQL-0.1.9.4.tar.gz diff --git a/python-clicksql.spec b/python-clicksql.spec new file mode 100644 index 0000000..f5f1f9f --- /dev/null +++ b/python-clicksql.spec @@ -0,0 +1,423 @@ +%global _empty_manifest_terminate_build 0 +Name: python-ClickSQL +Version: 0.1.9.4 +Release: 1 +Summary: A python client for Clickhouse +License: MIT Licence +URL: http://www.github.com/sn0wfree/ClickSQL +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/5d/eb/522a32d8fa4483b9cfd58ce3b40d2c2f896c238080e55bc1f662042b6de5/ClickSQL-0.1.9.4.tar.gz +BuildArch: noarch + + +%description +Package information: +ClickSQL is a python client for ClickHouse database, which may help users to use ClickHouse more easier and pythonic. +More information for ClickHouse can be found at [here](http://clickhouse.tech) +## Installation +`pip install ClickSQL` +## Usage +### Initial connection +to setup a database connection and send a heartbeat-check signal +```python +from ClickSQL import BaseSingleFactorTableNode +conn_str = "clickhouse://default:test121231@99.99.9.9:8123/system" +Node = BaseSingleFactorTableNode(conn_str) +>>> connection test: Ok. +``` +### Query +#### execute a SQL Query +```python +from ClickSQL import BaseSingleFactorTableNode +conn_str = "clickhouse://default:test121231@99.99.9.9:8123/system" +Node = BaseSingleFactorTableNode(conn_str) +Node('show tables from system limit 1') +>>> connection test: Ok. +>>> name +>>> 0 aggregate_function_combinators +``` +#### execute a Query without SQL +```python +from ClickSQL import BaseSingleFactorTableNode +factor = BaseSingleFactorTableNode( + 'clickhouse://default:default@127.0.0.1:8123/sample.sample', + cols=['cust_no', 'product_id', 'money'], + order_by_cols=['money asc'], + money='money >= 100000' + ) +factor['money'].head(10) +>>> connection test: Ok. +>>> money +>>> 0 1000000.0 +>>> 1 1000000.0 +>>> 2 1000000.0 +>>> 3 1000000.0 +>>> 4 1000000.0 +>>> 5 1000000.0 +>>> 6 1000000.0 +>>> 7 1000000.0 +>>> 8 1000000.0 +>>> 9 1000000.0 +``` +## Insert data +insert data into database by various ways +### Insert data via DataFrame +```python +from ClickSQL import BaseSingleFactorTableNode as factortable +import numpy as np +import pandas as pd +factor = factortable( 'clickhouse://default:default@127.0.0.1:8123/sample.sample' ) +db = 'sample' +table = 'sample' +df = pd.DataFrame(np.random.random(size=(10000,3)),columns=['cust_no', 'product_id', 'money']) +factor.insert_df(df, db, table, chunksize=100000) +``` +### Insert data via SQL(Inner) +```python +from ClickSQL import BaseSingleFactorTableNode as factortable +factor = factortable( 'clickhouse://default:default@127.0.0.1:8123/sample.sample' ) +factor("insert into sample.sample select * from other_db.other_table") +``` +### Create table +#### Create table by SQL +```python +from ClickSQL import BaseSingleFactorTableNode +conn_str = "clickhouse://default:test121231@99.99.9.9:8123/system" +Node = BaseSingleFactorTableNode(conn_str) +Node('create table test.test2 (v1 String, v2 Int64, v3 Float64,v4 DataTime) Engine=MergeTree() order by v4') +``` +#### Create table by DataFrame +```python +from ClickSQL import BaseSingleFactorTableNode +import numpy as np +import pandas as pd +conn_str = "clickhouse://default:test121231@99.99.9.9:8123/system" +Node = BaseSingleFactorTableNode(conn_str) +db = 'test' +table = 'test2' +df_or_sql_or_dict = pd.DataFrame(np.random.random(size=(10000,2)),columns=['v1', 'v3']) +df_or_sql_or_dict['v2'] =1 +df_or_sql_or_dict['v4'] =pd.to_datetime('2020-01-01 00:00:00') +Node.create( db, table, df_or_sql_or_dict, key_cols=['v4'],) +``` +### Contribution +Welcome to improve this package or submit an issue or any others +## Author +sn0wfree +# Plan +## Available functions or properties +1. get data from clickhouse +2. insert data into clickhouse +3. create +4. alter +5. execute standard SQL and transform into DataFrame(Auto) +3. able to execute select query +4. able to execute insert query +5. no require clickhouse-client +6. auto create table sql +7. can execute explain query +8. Insert Data via DataFrame +3. alter function & drop function +## In Process +2. create a pandas_liked executable function, which can compatible with pandas +9. distributed query(query+insert) +## schedule +1. ORM +4. can execute user role query +5. create analysis component +6. auto report system +7. table register system +8. data manager system +8. meta data manager + +%package -n python3-ClickSQL +Summary: A python client for Clickhouse +Provides: python-ClickSQL +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-ClickSQL +Package information: +ClickSQL is a python client for ClickHouse database, which may help users to use ClickHouse more easier and pythonic. +More information for ClickHouse can be found at [here](http://clickhouse.tech) +## Installation +`pip install ClickSQL` +## Usage +### Initial connection +to setup a database connection and send a heartbeat-check signal +```python +from ClickSQL import BaseSingleFactorTableNode +conn_str = "clickhouse://default:test121231@99.99.9.9:8123/system" +Node = BaseSingleFactorTableNode(conn_str) +>>> connection test: Ok. +``` +### Query +#### execute a SQL Query +```python +from ClickSQL import BaseSingleFactorTableNode +conn_str = "clickhouse://default:test121231@99.99.9.9:8123/system" +Node = BaseSingleFactorTableNode(conn_str) +Node('show tables from system limit 1') +>>> connection test: Ok. +>>> name +>>> 0 aggregate_function_combinators +``` +#### execute a Query without SQL +```python +from ClickSQL import BaseSingleFactorTableNode +factor = BaseSingleFactorTableNode( + 'clickhouse://default:default@127.0.0.1:8123/sample.sample', + cols=['cust_no', 'product_id', 'money'], + order_by_cols=['money asc'], + money='money >= 100000' + ) +factor['money'].head(10) +>>> connection test: Ok. +>>> money +>>> 0 1000000.0 +>>> 1 1000000.0 +>>> 2 1000000.0 +>>> 3 1000000.0 +>>> 4 1000000.0 +>>> 5 1000000.0 +>>> 6 1000000.0 +>>> 7 1000000.0 +>>> 8 1000000.0 +>>> 9 1000000.0 +``` +## Insert data +insert data into database by various ways +### Insert data via DataFrame +```python +from ClickSQL import BaseSingleFactorTableNode as factortable +import numpy as np +import pandas as pd +factor = factortable( 'clickhouse://default:default@127.0.0.1:8123/sample.sample' ) +db = 'sample' +table = 'sample' +df = pd.DataFrame(np.random.random(size=(10000,3)),columns=['cust_no', 'product_id', 'money']) +factor.insert_df(df, db, table, chunksize=100000) +``` +### Insert data via SQL(Inner) +```python +from ClickSQL import BaseSingleFactorTableNode as factortable +factor = factortable( 'clickhouse://default:default@127.0.0.1:8123/sample.sample' ) +factor("insert into sample.sample select * from other_db.other_table") +``` +### Create table +#### Create table by SQL +```python +from ClickSQL import BaseSingleFactorTableNode +conn_str = "clickhouse://default:test121231@99.99.9.9:8123/system" +Node = BaseSingleFactorTableNode(conn_str) +Node('create table test.test2 (v1 String, v2 Int64, v3 Float64,v4 DataTime) Engine=MergeTree() order by v4') +``` +#### Create table by DataFrame +```python +from ClickSQL import BaseSingleFactorTableNode +import numpy as np +import pandas as pd +conn_str = "clickhouse://default:test121231@99.99.9.9:8123/system" +Node = BaseSingleFactorTableNode(conn_str) +db = 'test' +table = 'test2' +df_or_sql_or_dict = pd.DataFrame(np.random.random(size=(10000,2)),columns=['v1', 'v3']) +df_or_sql_or_dict['v2'] =1 +df_or_sql_or_dict['v4'] =pd.to_datetime('2020-01-01 00:00:00') +Node.create( db, table, df_or_sql_or_dict, key_cols=['v4'],) +``` +### Contribution +Welcome to improve this package or submit an issue or any others +## Author +sn0wfree +# Plan +## Available functions or properties +1. get data from clickhouse +2. insert data into clickhouse +3. create +4. alter +5. execute standard SQL and transform into DataFrame(Auto) +3. able to execute select query +4. able to execute insert query +5. no require clickhouse-client +6. auto create table sql +7. can execute explain query +8. Insert Data via DataFrame +3. alter function & drop function +## In Process +2. create a pandas_liked executable function, which can compatible with pandas +9. distributed query(query+insert) +## schedule +1. ORM +4. can execute user role query +5. create analysis component +6. auto report system +7. table register system +8. data manager system +8. meta data manager + +%package help +Summary: Development documents and examples for ClickSQL +Provides: python3-ClickSQL-doc +%description help +Package information: +ClickSQL is a python client for ClickHouse database, which may help users to use ClickHouse more easier and pythonic. +More information for ClickHouse can be found at [here](http://clickhouse.tech) +## Installation +`pip install ClickSQL` +## Usage +### Initial connection +to setup a database connection and send a heartbeat-check signal +```python +from ClickSQL import BaseSingleFactorTableNode +conn_str = "clickhouse://default:test121231@99.99.9.9:8123/system" +Node = BaseSingleFactorTableNode(conn_str) +>>> connection test: Ok. +``` +### Query +#### execute a SQL Query +```python +from ClickSQL import BaseSingleFactorTableNode +conn_str = "clickhouse://default:test121231@99.99.9.9:8123/system" +Node = BaseSingleFactorTableNode(conn_str) +Node('show tables from system limit 1') +>>> connection test: Ok. +>>> name +>>> 0 aggregate_function_combinators +``` +#### execute a Query without SQL +```python +from ClickSQL import BaseSingleFactorTableNode +factor = BaseSingleFactorTableNode( + 'clickhouse://default:default@127.0.0.1:8123/sample.sample', + cols=['cust_no', 'product_id', 'money'], + order_by_cols=['money asc'], + money='money >= 100000' + ) +factor['money'].head(10) +>>> connection test: Ok. +>>> money +>>> 0 1000000.0 +>>> 1 1000000.0 +>>> 2 1000000.0 +>>> 3 1000000.0 +>>> 4 1000000.0 +>>> 5 1000000.0 +>>> 6 1000000.0 +>>> 7 1000000.0 +>>> 8 1000000.0 +>>> 9 1000000.0 +``` +## Insert data +insert data into database by various ways +### Insert data via DataFrame +```python +from ClickSQL import BaseSingleFactorTableNode as factortable +import numpy as np +import pandas as pd +factor = factortable( 'clickhouse://default:default@127.0.0.1:8123/sample.sample' ) +db = 'sample' +table = 'sample' +df = pd.DataFrame(np.random.random(size=(10000,3)),columns=['cust_no', 'product_id', 'money']) +factor.insert_df(df, db, table, chunksize=100000) +``` +### Insert data via SQL(Inner) +```python +from ClickSQL import BaseSingleFactorTableNode as factortable +factor = factortable( 'clickhouse://default:default@127.0.0.1:8123/sample.sample' ) +factor("insert into sample.sample select * from other_db.other_table") +``` +### Create table +#### Create table by SQL +```python +from ClickSQL import BaseSingleFactorTableNode +conn_str = "clickhouse://default:test121231@99.99.9.9:8123/system" +Node = BaseSingleFactorTableNode(conn_str) +Node('create table test.test2 (v1 String, v2 Int64, v3 Float64,v4 DataTime) Engine=MergeTree() order by v4') +``` +#### Create table by DataFrame +```python +from ClickSQL import BaseSingleFactorTableNode +import numpy as np +import pandas as pd +conn_str = "clickhouse://default:test121231@99.99.9.9:8123/system" +Node = BaseSingleFactorTableNode(conn_str) +db = 'test' +table = 'test2' +df_or_sql_or_dict = pd.DataFrame(np.random.random(size=(10000,2)),columns=['v1', 'v3']) +df_or_sql_or_dict['v2'] =1 +df_or_sql_or_dict['v4'] =pd.to_datetime('2020-01-01 00:00:00') +Node.create( db, table, df_or_sql_or_dict, key_cols=['v4'],) +``` +### Contribution +Welcome to improve this package or submit an issue or any others +## Author +sn0wfree +# Plan +## Available functions or properties +1. get data from clickhouse +2. insert data into clickhouse +3. create +4. alter +5. execute standard SQL and transform into DataFrame(Auto) +3. able to execute select query +4. able to execute insert query +5. no require clickhouse-client +6. auto create table sql +7. can execute explain query +8. Insert Data via DataFrame +3. alter function & drop function +## In Process +2. create a pandas_liked executable function, which can compatible with pandas +9. distributed query(query+insert) +## schedule +1. ORM +4. can execute user role query +5. create analysis component +6. auto report system +7. table register system +8. data manager system +8. meta data manager + +%prep +%autosetup -n ClickSQL-0.1.9.4 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-ClickSQL -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.9.4-1 +- Package Spec generated @@ -0,0 +1 @@ +f15097bd292601c3b3dffeb7273f4f5c ClickSQL-0.1.9.4.tar.gz |
