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

The Archive Base Latest Questions

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

Im sending sqlalchemy objects trough net to another machine. First I serialize it to

  • 0

Im sending sqlalchemy objects trough net to another machine. First I serialize it to a string, then crypting and sending.
I serialize it with:

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalchemy.ext.serializer import loads, dumps
engine = create_engine(connection_str)
S = scoped_session(sessionmaker(bind=engine, expire_on_commit=False))
session = S()

data = session(MyObj).all()
serialized = pickle.dumps([dumps(d) for d in data])

crypted = crypt(serialized) #encrypting the serialized data
send(machine, crypted)      #sending encripted data to 'machine'

and on the other machine:

encrypted = get_data()
serialized = decrypt(encrypted)
data = [loads(d, Base.metadata, S) for d in pickle.loads(serialized)]

for d in data:
    session.merge(d)
session.commit()

but it throws: (IntegrityError) node_type.id may not be NULL u'INSERT INTO myobj (col1, col2) VALUES (?, ?)' (None, None)

and when i try to print the data it throws: DetachedInstanceError Instance <MyObj at 0x24e0c70> is not bound to a Session; attribute refresh operation cannot proceed
or an:ObjectDeletedError

what is the problem?

here:
How to create and restore a backup from SqlAlchemy? is told that session.merge() would be fine, but it didnt work for me.

  • 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-16T04:33:13+00:00Added an answer on June 16, 2026 at 4:33 am

    From the docs for sqlalchemy.ext.serializer:

    “The serializer module is only appropriate for query structures. It is
    not needed for […] instances of user-defined classes”

    Maybe try to just use pickle and not sqlalchemy.ext.serializer for this use case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sending objects to ASP.NET from JSON works fine if you have a class built
When sending data from one iOS device to another, I receive these errors. 2012-06-21
I sending a String from a UIButton to my next UITtableviewcontroller, the string is
When sending mail using system.net. Having specified from attribute in system.net->mailsetting->smtp. In send method
im sending a value from one page in aspx to another page as shown
When sending a signal from one process to another, I also want to send
Sending data from Windows machine to the Windows or Linux over network with high
Im sending data from one class to another, Its working but I have a
Sending XML from C# Server and receiving it it in Android Java client This
sending text to label and number to int from tabelview to viewcontroller but it

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.