julien-duponchelle / julien-duponchelle/python-mysql-replication

fail when 'database' is used as connection setting

Open
#123 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.4k
Forks
690
PR merge metrics
No merged PRs in 30d

Description

Connecting with _'database'_ as a connection setting (instead of _'db'_), will raise an error down the streaming line

``` python
settings = {
'host': 'localhost',
'port': 3306,
'user': 'root',
'passwd': '',
'database': 'stuff',
}
stream = BinLogStreamReader(connection_settings=settings, server_id=42)

for event in stream:
event.dump()
```

Will raise the following error in _TableMapEvent_

**pymysql.err.ProgrammingError: (1146, u"Table 'stuff.columns' doesn't exist")**

It seems that _'db'_ is overwritten internaly, but PyMysql will favor _'database'_ when present

Contributor guide

Open the contributing guide

Research direction

Start at BinLogStreamReader and follow the connection settings into TableMapEvent, using the reported example as the reproduction. Check how the 'db' and 'database' settings are handled by PyMySQL and the replication code. Done means the example connects with 'database' and processes events without the TableMapEvent lookup error.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, python
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.