简体   繁体   中英

How to import MySQL data using Sqoop in Python?

This is the code I wrote in terminal and works perfectly fine.

sqoop import --connect jdbc:mysql://localhost/testDb --username Amel -password Amel@-1998 --table mock3

I want to do the same thing but on PyCharm. What setting or lines of code should I use?

I'm quite new and I've been doing plenty of research but I can't find a relevant answer.

You can execute your commands by calling os.system() or subprocess.call()

import subprocess
subprocess.call(["echo", "Hello", "World"])  # substitute your command as an array of strings
import os
os.system("echo Hello World")  #  substitute your command

There is also a library called pysqoop to use sqoop, check details from here . Your IDE (Pycharm) does not affect the solution.

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