Run sqoop in python script
Question: I'm trying to run sqoop command inside Python script. I had no problem to do
that trough shell command, but when I'm trying to execute python stript:

    
    
    #!/usr/bin/python
    sqoopcom="sqoop import --direct --connect abcd --username abc --P --query "queryname" "
    
    exec (sqoopcom)
    

I got an error, Invalid syntax, how to solve it ?


Answer: You need to skip " on --query param

    
    
    sqoopcom="sqoop import --direct --connect abcd --username abc --P --query \"queryname\" --target-dir /pwd/dir --m 1 --fetch-size 1000 --verbose --fields-terminated-by , --escaped-by \\ --enclosed-by '\"'/dir/part-m-00000" 
    

