-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
ENH: support index=True for SQL io.sql.get_schema #9084
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
Comments
I can create a PR for this if wanted. Would we want the patch (i assume so) to be backwards compatible with |
vrajmohan
pushed a commit
to vrajmohan/pandas
that referenced
this issue
Jan 30, 2019
Closes pandas-dev#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.
vrajmohan
pushed a commit
to vrajmohan/pandas
that referenced
this issue
Jan 30, 2019
Closes pandas-dev#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.
2 tasks
vrajmohan
pushed a commit
to vrajmohan/pandas
that referenced
this issue
Feb 1, 2019
Closes pandas-dev#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.
After adding the index option, the returned default "index" name has double quotes. Is this expected? df = pd.DataFrame({
"one": [1, 2, 3], "two": [1, 2, 3]
}, index=list("abc"))
schema_with_index = sql.get_schema(df, 'test', index=True, con=self.conn)
CREATE TABLE test (
"index" TEXT,
one BIGINT,
two BIGINT
)
df.index.name = 'new_index'
schema_with_index_rename = sql.get_schema(df, 'test', index=True, con=self.conn)
CREATE TABLE test (
new_index TEXT,
one BIGINT,
two BIGINT
) |
5 tasks
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
pd.io.sql.get_schema
can be used to see the schema 'create table' statement. This function should support including the index (which is actually the default forto_sql
)The text was updated successfully, but these errors were encountered: