Home > Software engineering >  Api for oracle system for csv file upload using python
Api for oracle system for csv file upload using python

Time:10-28

I want to upload a CSV file to the oracle system using python code for billing and I created a python script to export the necessary data into a formatted CSV that the Oracle system can accept and allocate expenses accordingly.so I want to upload that CSV to the oracle system is there any API or something that I can go further and I need API URL's for oracle upload using python

CodePudding user response:

If you are into python csv2db will be your friend.

# https://github.com/csv2db/csv2db

# drop user
echo 'drop user csvdata cascade;' | sqlplus -S system/oracle@localhost:1521/XEPDB1

# create user and grant privileges
sqlplus -S system/oracle@localhost:1521/XEPDB1 <<EOF
create user csvdata identified by load default tablespace USERS temporary tablespace TEMP quota unlimited on USERS;
grant create session, resource to csvdata;
EOF

# generate DDL
time csv2db generate --file=movies.csv --table=MOVIES | sed 's/1000/4000/' \
| sqlplus -S csvdata/load@localhost:1521/XEPDB1

# load data
time csv2db load --user=csvdata --password=load --host=localhost --port=1521 --dbname=XEPDB1 \
       --separator=',' --table=MOVIES --directpath \
       --file=movies.csv

# what do we have?
echo 'select count(*) from movies;' | sqlplus -S csvdata/load@localhost:1521/XEPDB1

Best of luck!

  • Related