Oracle
 sql >> Cơ Sở Dữ Liệu >  >> RDS >> Oracle

Làm cách nào để xuất dữ liệu đã phân tích cú pháp từ Python sang bảng Oracle trong SQL Developer?

Từ Nhập tệp CSV vào Oracle bằng CX_Oracle &Python 2.7 bạn có thể thấy kế hoạch tổng thể. Vì vậy, nếu bạn đã phân tích dữ liệu thành csv, bạn có thể dễ dàng thực hiện như:

import cx_Oracle
import csv

dsnStr = cx_Oracle.makedsn("sole.wh.whoi.edu", "1526", "sole")

con = cx_Oracle.connect(user="myusername", password="mypassword",     dsn=dsnStr)
print (con.version)

#imp 'Book1.csv' [this didn't work]

cursor = con.cursor()
print (cursor)

text_sql = '''
INSERT INTO tablename (firstfield, secondfield) VALUES(:1,:2)
'''

my_file = 'C:\CSVData\Book1.csv'
cr = csv.reader(open(my_file,"rb"))
for row in cr:    
    print row
    cursor.execute(text_sql, row)
    print 'Imported'
con.close()



  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Tương đương với REF CURSOR của Oracle trong MySQL khi sử dụng JDBC là gì?

  2. node.js oracledb Không Chèn cũng không Cập nhật

  3. OracleDataSource so với Oracle UCP PoolDataSource

  4. Di chuyển Cơ sở dữ liệu Oracle từ AWS EC2 sang AWS RDS, Phần 3

  5. Sử dụng bí danh cột trong tính toán câu lệnh chọn Oracle SQL