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

  • SEARCH
  • Home
  • 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 8612973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:45:30+00:00 2026-06-12T04:45:30+00:00

I am attempting to implement this code https://gist.github.com/1859653 that allows sqlalchemy to interact with

  • 0

I am attempting to implement this code https://gist.github.com/1859653 that allows sqlalchemy to interact with an hstore column.

Its mentioned in that gist’s comments the need to run the psycopg2.extras.register_hstore. When and were should this function be run? If i do:

@app.before_request
def reg_hstore() :
register_hstore(db.engine.raw_connection(), True)

heroku errors with ‘too many connections’

there is also mention of using pghstore (http://pypi.python.org/pypi/pghstore) instead of psycopg2 but it gives no indication how to set it up.

Also, I’m wondering if the use of hstore indexes is supported in this add-on code.

  • 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-12T04:45:31+00:00Added an answer on June 12, 2026 at 4:45 am

    Try this:

    from flaskext.sqlalchemy import SQLAlchemy
    import psycopg2
    import psycopg2.extras
    
    class _SQLAlchemy(SQLAlchemy):
        def apply_driver_hacks(self, app, info, options):
            """This method adds option to support hstore on psycopg2"""
    
            if info.drivername == "postgres":
                def _connect():
                    conn = psycopg2.connect(user=info.username,
                                            host=info.host,
                                            port=info.port,
                                            dbname=info.database,
                                            password=info.password)
                    psycopg2.extras.register_hstore(conn)
                    return conn
                options["creator"] = _connect
            SQLAlchemy.apply_driver_hacks(self, app, info, options)
    

    Also see:

    • http://packages.python.org/Flask-SQLAlchemy/api.html?highlight=apply_driver_hack#flask.ext.sqlalchemy.SQLAlchemy.apply_driver_hacks
    • http://docs.sqlalchemy.org/en/rel_0_7/core/engines.html#custom-dbapi-connect-arguments
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to implement window-flipping identical to that in iWork - https://dl.dropbox.com/u/2338382/Window%20Flipping.mov However, I
I am attempting to implement a form on APEX that allows the user (in
I'm attempting to implement the MSDN example (http://msdn.microsoft.com/en-us/library/swx5easy.aspx) for Thread.Timers in my own code.
I am attempting to implement thread-safe usage of ConcurentHashMap within singleton spring service that
I'm attempting to implement OpenID with ASP.NET MVC (Yeah, we haven't heard that one
i am attempting to implement a built in controller that is part of the
I'm using this android calendar http://w2davids.wordpress.com/android-simple-calendar/ and attempting to populate it with events. In
I have a web form that I am attempting to implement dynamic drop down
I am attempting to implement a custom view. This view should display an image
I am attempting to implement the suckerfish menu found on this tutorial. I get

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.