Send Data to specific branch using specklepy

Hi community!
hopefully is a quick one but I cant figure this out.
I’ve programmatically created Streams and branches using specklepy without a hitch :wink:
now, every package I send using transport is always sent to the main stream.
I’ve tried using the Stream Wrapper to create a transport directed to a branch url but im getting an error:

sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 4000 and this is thread id 12892

how can I select a specific branch to send data to?

keep up the good work!

Hi @dvalent ,
Welcome to the community! Feel free to Introduce yourself :person_gesturing_ok: to the community if you want to! :smiley:

I found this on our Examples repo and i think it does what you ask for. Can you give it a try?

1 Like

Just to clarify a bit on @gokermu’s answer:

the ServerTransport is kind of a “dumb” concept that is only in charge of:

  • Sending an object to a stream and returning it’s ID
  • Receiving an object from a stream by it’s ID

The transport does not send to a specific branch, all uploaded objects belong to a Stream, but are not part of any branch unless you create a commit after uploading it. Which is when you’re able to specify what branch it should belong to.

Notice that on the example Bilal shared, when creating a Transport, you only need to specify the Stream it points to.

I will admit that the error you’re getting seems rather unhelpful :sweat: Could you share with us a snippet of your code so we can see what’s going on, and either prevent it from happening, or display a more meaningful error instead? :slight_smile:

Thanks for reporting this! :raised_hands:t3:

2 Likes

Thanks @gokermu , this was it! a simple branch_name argument! all working now

4 Likes

I realized the error was more verbose after the post - I will edit it
Essentially when I looked into the transport object the account keys were empty - even though I authorized with a token previously - the error I was getting it was a credentials error in the end. I installed the speckle Manager and the error just went away.

I will investigate further - Thanks!

3 Likes