2016-06-21 52 views
1

我正在生成一個文本文件,plink正在使用impala shell並使用-q運行插入語句。目前使用來自維基百科的虛擬數據來確保它在憤怒中使用之前沒有錯誤。Impala Shell query -q在字符串中使用雙引號

這在除下列(我已經改變了一些位,但結果是一樣的),幾乎所有的情況下工作正常:

impala-shell -c -k -q "INSERT INTO TABLE imaginarydatabasename.T_Test 
VALUES 
('Bob','Monkhouse','1928-06-01',2003,'An expert on the history of silent cinema and a film collector, Monkhouse presented Mad Movies in 1966. He wrote, produced, financed and syndicated the show worldwide. The show featured clips from comic silent films, many from his own private collection, some of which he had helped to recover and restore. This film collection was the cause of a court case at the Old Bailey in 1979. Having loaned Terry Wogan\'s son a film, Monkhouse was charged with attempting to defraud film distributors of royalties, but after two years the judge decided that there was no case to answer.[8] Many of the films in his collection were seized and not returned to Monkhouse.[9] In 2008, the British Film Institute was contacted by Monkhouse\'s daughter, Abigail, who asked if they would like to view the collection and provide some advice as to the best way of preserving it. Amongst the discoveries were many radio and TV shows long thought lost. Dick Fiddy, the archivist, said \"It\'s a huge, unwieldy collection which deals with a number of areas. It\'s not just film and TV. Initially, we found half a dozen TV shows that we knew to be missing.\" Amongst those shows rediscovered were many that feature Monkhouse himself, including The Flip Side, a 1966 play in which he starred as a television DJ with his own late night show, and the 1957/58 series of his comedy My Pal Bob including an episode in which he is suspected of an extramarital affair.[10] The archive consisted of 36,000 videotapes, going back to when Monkhouse first bought a home video recorder in 1966. His film archive began in the late 1950s. The entire Monkhouse film and television archive is now held by Kaleidoscope, including all the material previously held by the NFTVA. It was catalogued and restored to digital formats for a major event at Bafta on 24 October 2009. Chris Perry, of Kaleidoscope and Kaleidoscope Publishing, said: \"We are painstakingly transferring the important contents of the video tapes and restoring radio shows. There are many incredible finds, and the event [is] an exciting time for all concerned.\" In his final years, Monkhouse hosted a show on BBC Radio 2 called The Monkhouse Archive, in which he provided humorous links to clips of comedy acts spanning the previous 50 years.',1,2.5,'2016-06-21 14:41:25');" -i impala-server.com; 

如果我複製外雙引號內的部分(什麼是由q運行),粘貼到色調和執行它,我沒有任何問題。

我相信正在發生的事情是第五列中的雙引號告訴shell的-q部分查詢文本已經結束。

如何告訴shell雙引號沒有結束?

回答

1

這是\

你必須這樣做不是一次,兩次,而是三次如下:

impala-shell -c -k -q "INSERT INTO TABLE database.table 
VALUES 
('Bob','Monkhouse','1928-06-01',2003,'see if I can get \\\ to work...',1,2.5,'2016-06-21 14:41:25');" -i impala-server; 
1

測試它的一種方法是運行直選語句而不是插入來查看impala shell是否能夠執行查詢。從代碼中查看下面的示例。我能夠沒有任何問題地執行它,但是如果我擺脫了任何轉義字符,它將會出錯,所以我不認爲雙引號引起了問題。

impala-shell -i impala-server.com -c -k -q "select 'Bob','Monkhouse','1928-06-01',2003,'An expert on the history of silent cinema and a film collector, Monkhouse presented Mad Movies in 1966. He wrote, produced, financed and syndicated the show worldwide. The show featured clips from comic silent films, many from his own private collection, some of which he had helped to recover and restore. This film collection was the cause of a court case at the Old Bailey in 1979. Having loaned Terry Wogan\'s son a film, Monkhouse was charged with attempting to defraud film distributors of royalties, but after two years the judge decided that there was no case to answer.[8] Many of the films in his collection were seized and not returned to Monkhouse.[9] In 2008, the British Film Institute was contacted by Monkhouse\'s daughter, Abigail, who asked if they would like to view the collection and provide some advice as to the best way of preserving it. Amongst the discoveries were many radio and TV shows long thought lost. Dick Fiddy, the archivist, said \"It\'s a huge, unwieldy collection which deals with a number of areas. It\'s not just film and TV. Initially, we found half a dozen TV shows that we knew to be missing.\" Amongst those shows rediscovered were many that feature Monkhouse himself, including The Flip Side, a 1966 play in which he starred as a television DJ with his own late night show, and the 1957/58 series of his comedy My Pal Bob including an episode in which he is suspected of an extramarital affair.[10] The archive consisted of 36,000 videotapes, going back to when Monkhouse first bought a home video recorder in 1966. His film archive began in the late 1950s. The entire Monkhouse film and television archive is now held by Kaleidoscope, including all the material previously held by the NFTVA. It was catalogued and restored to digital formats for a major event at Bafta on 24 October 2009. Chris Perry, of Kaleidoscope and Kaleidoscope Publishing, said: \"We are painstakingly transferring the important contents of the video tapes and restoring radio shows. There are many incredible finds, and the event [is] an exciting time for all concerned.\" In his final years, Monkhouse hosted a show on BBC Radio 2 called The Monkhouse Archive, in which he provided humorous links to clips of comedy acts spanning the previous 50 years.',1,2.5,'2016-06-21 14:41:25'" 
+0

真,如下真是太開心了: '黑斑羚-shell -c -k -q「select *,'\」Mr \'Bob'workshop'從database.table中檢測到的東西「-B -o」Test.txt「--output_delimiter ='|' --print_header -i impala-server;' 也許是原始字符串中的方括號或其他東西。我將不得不使用試驗和錯誤,並查看造成問題的原因。 –

相關問題