Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 9ae39c2

Browse files
author
kuba--
committed
Add integration script
Signed-off-by: kuba-- <[email protected]>
1 parent 8d42337 commit 9ae39c2

File tree

5 files changed

+47
-0
lines changed

5 files changed

+47
-0
lines changed

SUPPORTED_CLIENTS.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ These are the clients we actively test against to check are compatible with go-m
55
- Python
66
- [pymysql](#pymysql)
77
- [mysql-connector](#python-mysql-connector)
8+
- [sqlalchemy](#python-sqlalchemy)
89
- Ruby
910
- [ruby-mysql](#ruby-mysql)
1011
- [PHP](#php)
@@ -65,6 +66,19 @@ finally:
6566
connection.close()
6667
```
6768

69+
### Python sqlalchemy
70+
71+
```python
72+
import pandas as pd
73+
import sqlalchemy
74+
75+
engine = sqlalchemy.create_engine('mysql+pymysql://user:[email protected]:3306/dbname')
76+
with engine.connect() as conn:
77+
repo_df = pd.read_sql_table("mytable", con=conn)
78+
for table_name in repo_df.to_dict():
79+
print(table_name)
80+
```
81+
6882
### ruby-mysql
6983

7084
```ruby
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
dependencies:
2+
python -m pip install -r requirements.txt
3+
4+
test: dependencies
5+
python -m unittest discover
6+
7+
.PHONY: dependencies test
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pandas
2+
sqlalchemy
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import unittest
2+
import pandas as pd
3+
import sqlalchemy
4+
5+
6+
class TestMySQL(unittest.TestCase):
7+
8+
def test_connect(self):
9+
engine = sqlalchemy.create_engine('mysql+pymysql://user:[email protected]:3306/test')
10+
with engine.connect() as conn:
11+
expected = {
12+
"name": {0: 'John Doe', 1: 'John Doe', 2: 'Jane Doe', 3: 'Evil Bob'},
13+
14+
"phone_numbers": {0: '["555-555-555"]', 1: '[]', 2: '[]', 3: '["555-666-555","666-666-666"]'},
15+
"created_at": {0: pd.Timestamp('2019-01-28 15:35:51'), 1: pd.Timestamp('2019-01-28 15:35:51'), 2: pd.Timestamp('2019-01-28 15:35:51'), 3: pd.Timestamp('2019-01-28 15:35:51')},
16+
}
17+
18+
repo_df = pd.read_sql_table("mytable", con=conn)
19+
20+
self.assertEqual(expected, repo_df.to_dict())
21+
22+
23+
if __name__ == '__main__':
24+
unittest.main()

test-server

15.9 MB
Binary file not shown.

0 commit comments

Comments
 (0)