How can we send data from Python in tulip database table, please suggest

How can we send data from Python in tulip database table, please suggest.

hello @nitingoel82, welcome to the Tulip Community!!

that’s a great question, and can be achieved with the use of Tulip Tables API: How to Use the Table API | Tulip Help Center - Support for Building Manufacturing Apps. you will need to create an API key for your Tulip Table and then send the data using the /tables/{tableId}/records (POST) endpoint. you can navigate to https://{{instance_name}}.tulip.co/apiDocs for the API documentation.

this guide: Guide: Using the Table API and Python to import data from a Tulip Table into Power BI maybe useful (although it provides an example of getting data from a Tulip Table to PowerBI) it provides good library suggestions and reference material for how to use Python to interact with data in Tulip Tables.

let us know if you have further questions!!

I have wrote program in Python and need to send data through python job, how to authenticate tulip and send data, article is not useful

OK @nitingoel82, have you created a Bot that allows for writing to a Tulip Table?? you can use that information in the Headers for Authentication:


ok, What information i need mention in python program

Hi @nitingoel82, can you describe a bit more what your Python script does? Is it generating the data you want to store in tables? I’ve included an example of how you might store one row of information for the script execution, but you could loop this if you wanted to quite easily.

import time
import requests
import json

header = #Add Auth Header from Tulip Bot
endpoint = #Add API endpoint to hit from API docs i.e. "https://<instance-name>.tulip.co/api/v3/tables/<tableID>/records"

# Form JSON object to send to endpoint, example below is the ID column
# and one faux column. This is getting two variables test1 and test2
json_dict = {'id': test1, 'abcde_column1': test2}
json_object = json.dumps(json_dict)

# Now we need to execute the POST request with the endpoint, header, and object.
response = requests.post(endpoint, headers = {'Authorization' : header}, data=json_object, verify=False)
print(response)

# If looping, I'd recommend the time sleep function to add a slight delay for responses
# time.sleep(0.2)
1 Like

I am getting response 422 error while insert the data.

Can you send me a link to the table you’re trying to POST to? My guess is the json_dict value was not updated appropriately for your request. Feel free to send me an email at grant.levy@tulip.co as well to share details around the JSON object you’re building.