Send Data from Python and Tulip

Hey,

I want to perform a set of Operation in Anaconda(python) and after this, send the modified Table to Tulip, how to get this done? I also want to send Data back and forth from Tulip to Python, is this Possible? for Example, if i click a Button in Tulip , tulip should send the Data back to Python.

Hello,

You have to create a bot (here: https://your_instance.tulip.co/account-settings/bots) then use the API (https://your_instance.tulip.co/apiDocs) to read and write Tulip Table from Python.

If you are confortable with HTML requests, it should be fine.

RĂ©mi

Hallo,

thanks a lot.

do you know where i can understand how to make an html request?

Hi Kedar, you can learn about the requests library in python in many places. I like the tutorials on Real Python. There is a post from a few years ago on the forums here Guide: Using the Table API and Python to import data from a Tulip Table into Power BI. Using the Tulip API you will requests specific records (rows of a table) and manipulate those records. You won’t be pulling down an entire Tulip table. What do you mean when you say “If I click a button in Tulip, tulip should send the data back to Python”. For Tulip to send data anywhere you will have to have a server with a url.

Hello kedar,

As Ethan says, you can’t really send data from Tulip to Python.

If you really need to do this, one of the best way is :

  • Put your data in a Tulip table.
  • Have a Python script which read this table every 30s (for instance).
  • If the Python script detects a change, do something.

You read a Tulip table by using the request GET "/tables/{tableId}/records". It only returns 100 records maximum but if you sort with the field _createdAt or _updatedAt, you can obtain the last one.

1 Like

Hey @kedar -

@remi.bayon recommended the way I would (and have) approached this one in the past. One small note. There is an community-developed library for python that makes it even easier to pull data from Tulip in python:

Feel free to check it out
Pete

2 Likes