Forums
How to read a sql table using python in pipeline? - Printable Version

+- Forums (https://bdn.bdb.ai)
+-- Forum: BDB Knowledge Base (https://bdn.bdb.ai/forumdisplay.php?fid=13)
+--- Forum: BDB Data Pipeline (https://bdn.bdb.ai/forumdisplay.php?fid=48)
+---- Forum: BDB Data Pipeline Q & A (https://bdn.bdb.ai/forumdisplay.php?fid=17)
+---- Thread: How to read a sql table using python in pipeline? (/showthread.php?tid=344)



How to read a sql table using python in pipeline? - shreekantgosavi - 12-21-2022

Paste below script in meta information script section.

Provide required credentials.

import pandas as pd

from sqlalchemy import create_engine
def read_data():
   engine = create_engine('mysql://root:root@localhost/db')
                       #dbsystem://username:password@host/db
   df = pd.read_sql('SELECT * from table_name', con=engine)
   return df