Skip to content

Status of io.sql.get_schema as public function? #9960

Open
@jorisvandenbossche

Description

@jorisvandenbossche

At this moment, pd.io.sql.get_schema is not documented (not in the API docs, and not in the io docs). But, it is a potential useful function, so I think it would be good to be more explicit about its status (by mentioning it in the docs).

However, there are some quirks about the function:

  • The signature: pd.io.sql.get_schema(frame, name, flavor='sqlite', keys=None, con=Non e, dtype=None) -> flavor keyword in the third place, while we want to deprecate it (and this means you cannot do get_schema(df, 'name', engine), but always have to do get_schema(df, 'name', con=engine).
    Ideally this should have the same arguments (order) as to_sql (pd.io.sql.to_sql(frame, name, con, flavor='sqlite', schema=None, if_exists='fail', index=True, index_label=None, chunksize=None, dtype=None)) (only chunksize is not relevant)
  • It should have all options to modify the resulting sql table as to_sql
  • Maybe also the option to return the sqlalchemy Table instead of the string itself?

That we maybe should first solve before making it more explicitely public?

Triggered by http://stackoverflow.com/questions/29749356/python-pandas-export-structure-only-no-rows-of-a-dataframe-to-sql/

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementIO SQLto_sql, read_sql, read_sql_queryNeeds DiscussionRequires discussion from core team before further action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions