Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9129047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:39:28+00:00 2026-06-17T07:39:28+00:00

I have a custom connection factory class (which inherits from psycopg2.extensions.connection ) that I

  • 0

I have a custom connection factory class (which inherits from psycopg2.extensions.connection) that I would like SQLAlchemy to use. From the create_engine() documentation,

**kwargs takes a wide variety of options which are routed towards their appropriate components. Arguments may be specific to the Engine,
the underlying Dialect, as well as the Pool. Specific dialects also
accept keyword arguments that are unique to that dialect.

When I try to specify a connection_factory parameter, like this:

engine = create_engine(dsn.engine_info(), connection_factory=ConnectionEx)

I get this traceback:

Traceback (most recent call last):   File "foo.py", line 8, in <module>
    from user import test_user   File "/vagrant/workspace/panel/panel/user.py", line 18, in <module>
    from panel.helpers import intval   File "/vagrant/workspace/panel/panel/__init__.py", line 51, in <module>
    import panel.views   File "/vagrant/workspace/panel/panel/views.py", line 13, in <module>
    from panel.api import api_functions   File "/vagrant/workspace/panel/panel/api/api_functions.py", line 27, in <module>
    from panel.targeting import SavedTargetSet   File "/vagrant/workspace/panel/panel/targeting.py", line 19, in <module>
    from panel.database import panelists_tbl, us_cities_tbl, income_buckets_tbl   File "/vagrant/workspace/panel/panel/database.py", line 39, in <module>
    engine = create_engine(dsn.engine_info(), connection_factory=ConnectionEx)   File "/home/vagrant/.virtualenvs/project/lib/python2.6/site-packages/sqlalchemy/engine/__init__.py", line 331, in create_engine
    return strategy.create(*args, **kwargs)   File "/home/vagrant/.virtualenvs/project/lib/python2.6/site-packages/sqlalchemy/engine/strategies.py", line 141, in create
    engineclass.__name__)) TypeError: Invalid argument(s) 'connection_factory' sent to create_engine(), using configuration PGDialect_psycopg2/QueuePool/Engine.  Please check that the keyword arguments are appropriate for this combination of components.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T07:39:29+00:00Added an answer on June 17, 2026 at 7:39 am

    When the documentation is talking about “appropriate components,” its referring to the components of the SQLAlchemy API, rather than the various drivers. Since connection_factory is a parameter that needs to be sent to connect(), you should use the keyword connect_args in your call to create_engine (documentation also mentioned here). Thus:

    engine = create_engine(
        dsn.engine_info(), connect_args={'connection_factory': ConnectionEx})
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Service that uses a custom Connection class (extends thread) to a
I have created a custom collection class that I am trying to bind to
I'm writing a custom ASP.NET webcontrol and would like it to have a collection
I have written a custom client socket factory for RMI, so that if direct
When I've used common-collections I've done custom extensions to those utils like: class MyCollectionUtils
I have a custom runner that ships Junit tests over a socket connection to
In my web.config, I have a custom Url rewriter class that takes query strings
I have a custom class derived from QGraphicsPixmapItem. Its called GraphPixmapItemCustom and it's overloaded
We have a custom connection string provider that connects to different databases based on
I have developed an SSIS custom task component. It uses a connection manager of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.