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 6543009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:17:42+00:00 2026-05-25T11:17:42+00:00

is it possible to somehow use function register_composite from psycopg2, when i am using

  • 0

is it possible to somehow use function register_composite from psycopg2, when i am using sqlalchemy to connect to postgresql database?

My problem is that I want SQLAlchemy to handle custom composite type that i created in postgresql like this:

CREATE TYPE card AS (value int, suit text);

Sqlalchemy returns me values of this type as an string and I would like to somhow learn sqlalchemy my new type. If found some information about creating custom composite types in SQL alchemy ORM, but I am using just SQLAlechemy Core API (not ORM) and somebody on sqlalchemy IRC told me that psycopg should do it for me.

I would be happy with any advice, that would solve this.

Thank you
Josh

  • 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-05-25T11:17:43+00:00Added an answer on May 25, 2026 at 11:17 am

    Ok so, I will answer myself 🙂

    I have not found any way how to access to method register_composite of psycopg2 from sqlalchemy core api. But i am able to register new type via psycopg2 methods new_type and register_adapter. Tutorial can be found here.
    This methods allows you to register mapping from sql representation to python class and the other way.

    From SQLAlechemy connection you can access these methods like this:

    from sqlalchemy import *
    e = create_engine("postgresql://xxx:xxx@localhost:5432/db")
    c = e.connect()
    c.dialect.dbapi.extensions.register_adapter
    c.dialect.dbapi.extensions.new_type
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wonder if it's somehow possible to use the stop() function (I normally use
is it possible somehow to use the NOW() function or something similar in MYSQL
Is it possible to somehow use a .bat file to script the schema and/or
Is it somehow possible to use the 'With' keyword on an existing object? I
is it somehow possible to call a rails function or to access a rails
Is it somehow possible on Swing to set a TitledBorder transparent so that a
I have a number of tables that use the Postgres Partitioning feature. I want
Is it somehow possible to send a function to another function for it to
I'm using this plugin: http://www.fyneworks.com/jquery/star-rating/ Is it possible to put a click function inside
Since it's possible using the IsNumeric() and others VB.NET functions from IronPython by importing

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.