Create engine with given dialect object

Issue #3386 wontfix
EirN created an issue

I want to have same dialect object for different engines (for example, main and mock), so I want to define dialect not only with url string, but also with specifying dialect object.

    primary_engine = create_engine(connect_url, **other_params)
    pass   # do something here
    mock_engine = create_engine(primary_engine.dialect, strategy=mock, executor=some_executor)
    # Or better to have something like this:
    mock_engine = create_mock_engine(primary_engine.dialect, executor=some_executor')

Now I have to care about which dialect I use like this:

    primary_engine = create_engine(connect_url, **other_params)
    pass   # do something here
    mock_engine = create_engine('postgres:///', strategy=mock, executor=some_executor)

Comments (2)

  1. Mike Bayer repo owner

    why do you need to share the actual dialect object? Why can't the new engine have its own dialect which you specify with the string lookup as always?

    e.g.:

    mock_engine = create_engine(my_engine.url, strategy="mock", executor=some_executor)
    

    ?

  2. Log in to comment