BUG: writing invalid table names to sqlite
State: closed

I verified that the test exposes the bug prior to the fix for bug #13206.

Pandas from master
```
>>> import sqlite3
>>> import pandas as pd
>>> import numpy as np
>>> conn = sqlite3.connect(':memory:')
>>> df = pd.DataFrame({'A': [0, 1, 2], 'B': [0.2, np.nan, 5.6]})
>>> df.to_sql('d1187b08-4943-4c8d-a7f6-6c06b7cb9509', conn, index=False)
>>> 
```

Pandas 0.13.1
```
>>> import sqlite3
>>> import pandas as pd
>>> import numpy as np
>>> conn = sqlite3.connect(':memory:')
>>> df = pd.DataFrame({'A': [0, 1, 2], 'B': [0.2, np.nan, 5.6]})
>>> df.to_sql('d1187b08-4943-4c8d-a7f6-6c06b7cb9509', conn, index=False)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Projects\Sprints\PandasVirtualEnvLatest\PandasVirtualEnvLatest\oldpy27\lib\site-packages\pandas\core\frame.py", line 1261, in to_sql
    self, name, con, flavor=flavor, if_exists=if_exists, **kwargs)
  File "C:\Projects\Sprints\PandasVirtualEnvLatest\PandasVirtualEnvLatest\oldpy27\lib\site-packages\pandas\io\sql.py", line 226, in write_frame
    cur.execute(create)
OperationalError: near "-": syntax error
>>> 
```


Labels:
name: Testing
description: pandas testing functions or related to the test suite
name: IO SQL
description: to_sql, read_sql, read_sql_query

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=h1) Report
> Merging [#16464](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/04356a83c0dc8a749c84e168535e6673f2548ec6?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/16464/graphs/tree.svg?width=650&height=150&token=eZ4WkYLtcO&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #16464   +/-   ##
=======================================
  Coverage   90.42%   90.42%           
=======================================
  Files         161      161           
  Lines       51027    51027           
=======================================
  Hits        46142    46142           
  Misses       4885     4885
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.26% <ø> (ø)` | :arrow_up: |
| #single | `40.17% <ø> (ø)` | :arrow_up: |


------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=footer). Last update [04356a8...bc3a99d](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=h1) Report
> Merging [#16464](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/04356a83c0dc8a749c84e168535e6673f2548ec6?src=pr&el=desc) will **increase** coverage by `0.37%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/16464/graphs/tree.svg?width=650&height=150&token=eZ4WkYLtcO&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #16464      +/-   ##
==========================================
+ Coverage   90.42%   90.79%   +0.37%     
==========================================
  Files         161      161              
  Lines       51027    51063      +36     
==========================================
+ Hits        46142    46365     +223     
+ Misses       4885     4698     -187
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.63% <ø> (+0.37%)` | :arrow_up: |
| #single | `40.15% <ø> (-0.02%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/feather\_format.py](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=tree#diff-cGFuZGFzL2lvL2ZlYXRoZXJfZm9ybWF0LnB5) | `85.71% <0%> (-2.17%)` | :arrow_down: |
| [pandas/plotting/\_converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb252ZXJ0ZXIucHk=) | `63.23% <0%> (-1.82%)` | :arrow_down: |
| [pandas/core/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY2F0ZWdvcmljYWwucHk=) | `95.5% <0%> (-0.42%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.66% <0%> (-0.03%)` | :arrow_down: |
| [pandas/core/reshape/pivot.py](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9waXZvdC5weQ==) | `95.08% <0%> (ø)` | :arrow_up: |
| [pandas/core/resample.py](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzYW1wbGUucHk=) | `96.09% <0%> (+0.01%)` | :arrow_up: |
| [pandas/core/ops.py](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvb3BzLnB5) | `91.69% <0%> (+0.01%)` | :arrow_up: |
| [pandas/plotting/\_core.py](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb3JlLnB5) | `81.92% <0%> (+0.02%)` | :arrow_up: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `92.26% <0%> (+0.13%)` | :arrow_up: |
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `94.9% <0%> (+0.18%)` | :arrow_up: |
| ... and [7 more](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=footer). Last update [04356a8...bc3a99d](https://codecov.io/gh/pandas-dev/pandas/pull/16464?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

@jreback I've added the additional verification, and all checks are now passing.
Thanks!