8000 API: object oriented interface for SQL functionality · Issue #7960 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content
API: object oriented interface for SQL functionality #7960
@jorisvandenbossche

Description

@jorisvandenbossche

Follow-up of #6300 to discuss the object-oriented API for the sql functions.

So there are two ways to interact with SQL databases:

  • more simple, high-level functions: read_sql_query, read_sql_table, to_sql
  • "OO API" for more advanced functionality

The high-level functions are already quite polished (but there are still some issues with NaN, datetime, schema, ..), but the OO API should still be discussed and is not yet really public.

Current design:

  • PandasSQLAlchemy object (with execute, read_sql, read_table, to_sql, has_table, drop_table methods)
  • PandasSQLTable object to do the actual table reading/writing

Some questions remain:

  • What is this 'more advanced' usage that we want to enable in the API?
    • possibility to provide custom MetaData
    • the fact you don't recreate the object and metadata for each query (if you do multiple queries)
    • other sqlalchemy features people would want? Possibility to provide your own Table description instead of generating automatically?
    • more like HDF5Store? (getitem/setitem support? eg pandas_sql['table_name'] to read a table?)
  • What do we regard as public API?
    • Only PandasSQLAlchemy? Or also PandasSQLTable?
    • which methods of PandasSQLAlchemy should be public?
  • Naming:
    • naming of PandasSQLAlchemy -> do we need a better name? ('SQLDatabase', 'SQLdb', 'SQLConnection', ...)
    • naming of the methods (read_sql -> read_query?)
  • How do we see PandasSQLAlchemy?
    • wrapper around an Engine? or wrapper around Engine + MetaData
    • do we want to support reading/writing to multiple schema's? Or do you need to create seperate objects for each schema?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0