Search code examples
google-cloud-datalab

Datalab Notebook Answer y/N in prompt


In datalab notebook, I having been stuck in answering y/N in the output prompt.

for example,

  1. If I use !pip install somepackage -y , I can use flag -y to answer yes.

  2. However, when I try to copy some table from one dataset to another, it the destination table already exists, the prompt comes out to ask me to replace the destination table? but I can't type y in notebook, then the notebook will be stuck there.

    !bq cp project1:dataset1.table1 project2:dataset2.table2
    pop:
    cp: replace project2:dataset2.table2? (y/N)
    

There is no flag I can set to overwrite existing destination table, does anyone has any idea how to deal with this kind of situation? Otherwise, the notebook will keep running unless I force to stop it.

Thank you very much!


Solution

  • Adding questioner's comment (not mine) as the answer so that this doesn't appear as an unanswered question. Problem SOLVED! 1. use < !yes | bq cp project1:dataset1.ta‌​ble1 project2:dataset2.ta‌​ble2 > to repalce the destination table' 2. use < !yes n | bq cp ... > to not replace. Thank you.