Skip to content

feat: How to switch backend by only modifying the configuration? #11303

Open
@acracker

Description

@acracker

Is your feature request related to a problem?

No response

What is the motivation behind your request?

I have a task that involves converting data from a client's database into our own format. Although the source database fields are consistent, the underlying database systems vary — including MySQL, Oracle, and PostgreSQL. Therefore, I need a framework that can abstract away the differences between these database types.

While some ORM frameworks (like SQLAlchemy and Peewee) can achieve this, they typically require defining models, which adds complexity and overhead.

Based on this, I have some specific requirements:

I would like to be able to switch backend databases (e.g., from MySQL to Oracle) simply by modifying a configuration file.

Describe the solution you'd like

  1. The _post_connect method in the MySQL backend always raises warnings. I'm setting the time zone using SET @@session.time_zone = '+8:00'. It would be great to follow the design of the setsession parameter in dbutils.PersistentDB, where SQL commands are passed as a list to the connection. This way, I can define session-level settings and connection parameters together in a config file, making backend switching seamless.

  2. Is it possible to configure the database driver explicitly? For example, Ibis uses MySQLdb by default for MySQL connections, but I prefer to use pymysql. Can I pass the driver as a parameter? Any driver that follows the Python DB-API 2.0 should be compatible (similar to how creator works in dbutils).

What version of ibis are you running?

10.5.0

What backend(s) are you using, if any?

MySql, Oracle

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureFeatures or general enhancements

    Type

    No type

    Projects

    Status

    backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions