ENH: Support index=True for io.sql.get_schema
State: closed

Closes pandas-dev/pandas#9084

- Decided to keep the default as `index=False` to keep the API consistent. `to_sql` has `index=True`.
- Tempted to name the parameter `include_dataframe_index` as "index" has
a different meaning in a SQL context.

- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry


Labels:
name: Enhancement
name: IO SQL
description: to_sql, read_sql, read_sql_query

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25030?src=pr&el=h1) Report
> Merging [#25030](https://codecov.io/gh/pandas-dev/pandas/pull/25030?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/b9f2e2bd526ad69fe3d737d395742193e29fd0e5?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/25030/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/25030?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #25030   +/-   ##
=======================================
  Coverage   92.38%   92.38%           
=======================================
  Files         166      166           
  Lines       52401    52401           
=======================================
  Hits        48409    48409           
  Misses       3992     3992
```

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


------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25030?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/25030?src=pr&el=footer). Last update [b9f2e2b...f702c78](https://codecov.io/gh/pandas-dev/pandas/pull/25030?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/25030?src=pr&el=h1) Report
> Merging [#25030](https://codecov.io/gh/pandas-dev/pandas/pull/25030?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/ea013a254847fbc5551e3ec91a468370c7118589?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #25030      +/-   ##
==========================================
- Coverage   92.37%   92.36%   -0.01%     
==========================================
  Files         166      166              
  Lines       52403    52403              
==========================================
- Hits        48405    48404       -1     
- Misses       3998     3999       +1
```

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

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/25030?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/25030/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `88.04% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/25030?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/25030?src=pr&el=footer). Last update [ea013a2...722dc56](https://codecov.io/gh/pandas-dev/pandas/pull/25030?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

I think this has gone stale but please ping if you'd like to continue!