简体   繁体   中英

How to write the data in Python data frames back into database

I can connect to a SAP HANA database (in SAP Cloud) using the code below and successfully fetch data into a data frame:

 # Connecting to the Database and without the Column Name
 connection = pyhdb.connect('localhost', 30111, 'RRR', 'PsW')
 cursor = connection.cursor()
 cursor.execute("""
            SELECT * FROM PAL.VEGETARIAN_PREDICTION
                     """)
  # ab = cursor.fetchall()
  data = pd.DataFrame(cursor.fetchall())

Now I got the dataframe, but how can I save the data back to the database? Any coding can provide? Thanks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM