Skip to content

more details on required pip modules #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ Utility to import data into ClickHouse from MySQL (mainly) and/or CSV files

Data reader requires **Python 3.x** with additional modules to be installed.

`mysql-replication` package is used for communication with MySQL:
`MySQLdb` package is used for communication with MySQL:
```bash
pip install mysqlclient
```

`mysql-replication` package is used for communication with MySQL also:
[https://github.com/noplay/python-mysql-replication](https://github.com/noplay/python-mysql-replication)
```bash
pip install mysql-replication
Expand All @@ -43,6 +48,7 @@ pip install mysql-replication
pip install clickhouse-driver
```


Also the following (at least one of) MySQL privileges are required for this operation: `SUPER`, `REPLICATION CLIENT`

```mysql
Expand Down Expand Up @@ -133,7 +139,7 @@ Options description
# Performance

`pypy` significantly improves performance. You should try it.
For example you can start with [Portable PyPy distribution for Linux](https://github.com/squeaky-pl/portable-pypy#portable-pypy-distribution-for-linux)
For example you can start with [Portable PyPy distribution for Linux](https://github.com/squeaky-pl/portable-pypy#portable-pypy-distribution-for-linux) - use (Python 3.x release)[https://github.com/squeaky-pl/portable-pypy#latest-python-35-release]
Unpack it into your place of choice.

```bash
Expand All @@ -159,6 +165,17 @@ Install required modules
pypy3.5-5.9-beta-linux_x86_64-portable/bin/pip3 install mysql-replication
pypy3.5-5.9-beta-linux_x86_64-portable/bin/pip3 install clickhouse-driver
```
`mysqlclient` may require to install `libmysqlclient-dev` and `gcc`
```bash
pypy3.5-5.9-beta-linux_x86_64-portable/bin/pip3 install mysqlclient
```
Install them if need be
```bash
sudo apt-get install libmysqlclient-dev
```
```bash
sudo apt-get install gcc
```

Now you can run data reader via `pypy`
```bash
Expand Down
15 changes: 8 additions & 7 deletions src/tablebuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TableBuilder(object):
dbs = None
tables = None

def __init__(self, host, port, user, password=None, dbs=None, tables=None):
def __init__(self, host=None, port=None, user=None, password=None, dbs=None, tables=None):
self.host = host
self.port = port
self.user = user
Expand Down Expand Up @@ -221,14 +221,15 @@ def map_type(self, mysql_type, nullable=False):
return ch_type

if __name__ == '__main__':
tb = TableBuilder()
templates = tb.templates(
tb = TableBuilder(
host='127.0.0.1',
user='reader',
password='qwerty',
db='db',
# tables='datatypes, enum_datatypes, json_datatypes',
dbs=['db'],
# tables='datatypes, enum_datatypes, json_datatypes',
tables=['datatypes', 'enum_datatypes', 'json_datatypes'],
)
for table in templates:
print(table, '=', templates[table])
templates = tb.templates()
for db in templates:
for table in templates[db]:
print(table, '=', templates[db][table])