Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to write data to a sql table using python?
#1
Use python script component.
Paste below script in meta information script section.
Provide connection credentials.

import pandas as pd
from sqlalchemy import create_engine
def sql_write(data):

   # Connect to the database
   engine = create_engine('mysql+pymysql://user:password@host/database')

   # Store the data in the database
   data.to_sql('table_name', engine, if_exists='replace')
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)