fastmonkeys / stellar

Fast database snapshot and restore tool for development
MIT License
3.86k stars 119 forks source link

Quote DB names #55

Open prilka opened 8 years ago

prilka commented 8 years ago

I tried to use stellar with a Mysql/MariaDB database which has a dash in it's name.

The result is this:

$:[~]:$ stellar snapshot
Snapshotting database foo-bar
Traceback (most recent call last):
  File "/usr/local/bin/stellar", line 9, in <module>
    load_entry_point('stellar==0.4.3', 'console_scripts', 'stellar')()
  File "/usr/local/lib/python2.7/dist-packages/stellar/command.py", line 279, in main
    stellar()
...
...
  File "/usr/local/lib/python2.7/dist-packages/pymysql/err.py", line 112, in _check_mysql_exception
    raise errorclass(errno, errorvalue)
sqlalchemy.exc.ProgrammingError: (pymysql.err.ProgrammingError) (1064, u"You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-bar' at line 1") [SQL: 'SHOW TABLES in foo-bar;']

For Mysql the correct query should look like this: SHOW TABLES infoo-bar``