Import variables from MongoDB to MySQL

Viewed 26

We need to import variables from a MongoDB to a MySQL everytime we have an event. The Python code so far is:

    location = job_offer.get('location')[0]
    title_role = job_offer.get('title_role')[0]
    min_years = job_offer.get('min_years')[0]

    conn = pymysql.Connect(user='root', database='example', host='localhost', port=3306)
    cursor = conn.cursor()

    snapshot_date = datetime.date.today().strftime("%Y-%m-%d")

    statement = f"insert example_mysql (location, snapshot_date, title_role, min_years) values ('{job_title}', '{location}', '{min_years}');" 

This works for the three variables in the example that are arrays. Could anyone help with the code to import a variable that is an object? See in the screenshot the structure of the variable "needed_techs", which is different from the others: Screenshot of the data structure of the variables

0 Answers
Related