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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:50:35+00:00 2026-06-12T18:50:35+00:00

I have a module that uses Storm ORM to save data in a local

  • 0

I have a module that uses Storm ORM to save data in a local SQLite database. I’m working on another module that will sync the data to a central PostgreSQL server. I thought I would be clever and do the following:

unsynced = localStore.find(MyType, MyType.synced == False)

for assign in unsynced:
    self.remoteStore.add(assign)

This doesn’t quite work as hoped, the following error is thrown:

object at 0x18bb4d0 is part of another store

Is there some way to break the association with the local store so I can save the data remotely? This can be complicated slightly by the fact that I need to flip the synced flag in the local copy after successfully saving the data remotely.

  • 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-12T18:50:36+00:00Added an answer on June 12, 2026 at 6:50 pm

    There is nothing in Storm to do this automatically, since it isn’t always obvious what should be copied:

    1. The model class representing the table may not fully describe the underlying table. There may be additional fields that are not being used from the Python side.
    2. It isn’t clear what to do with foreign keys / references. Do you copy the related objects over too? Do you leave the foreign key IDs as is and hope that it doesn’t result in an integrity error when inserting into the second database? Do you try to find an equivalent object in the other database to reference? Which key would you use to do that search?

    Of course, these issues may not affect your application. In that case, you could write a method to duplicate an object so that it can be added to another store:

    def copy(self):
        """Create a new object with the same property values."""
        other = self.__class__()
        # Copy over the relevant fields.  If you're using an integer primary key,
        # then this probably doesn't include that key.
        other.foo = self.foo
        other.bar = self.bar
        ...
        return other
    

    You could then alter your code to do something like:

    for assign in unsynced:
        self.remoteStore.add(assign.copy())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My application is written in C. I have a module that uses some data
We have a multi-module maven project that uses a profile that defines a buildnumber-maven-plugin
I have a simple Python script that uses the socket module to send a
I have a module that uses std::string as part of its interface. I would
I have a module that uses multithreading. I want to store the number of
I have an Android project(A) that uses one library module(B) in Intellij IDEA 11.
Hi we have made a module for a controller and that module uses the
I am currently working on an Apache module that uses a large mmap file
I have a third party node module, that uses the old sys naming scheme,
I have play-framework application that uses one module which I've created by play new-module

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.