Insert all SQL Server table rows in a Google BigQuery Table











up vote
2
down vote

favorite












I want to know the best way (best performance and reaction time) to insert all rows of an SQL table into a Google BigQuery table. Actually, I am looping over a query result and insert the rows one by one into the BigQuery table.



The query GetShippingList returns all TShipping_ID of the table Shipping which has only one column:TShipping_ID. So, the SQL table has exactly the same schema of the BigQuery table.



<cfloop query="GetShippingList">
<cfset DateTime=mid("#now()#",6,19)>
<cfset TShipping_ID=TShipping_ID>

<!--- instancier un objet de type (class) TableRow --->
<cfobject action="create" type="java" class="com.google.api.services.bigquery.model.TableRow" name="row">
<cfset row.set("DateTime",DateTime)>
<cfset row.set("TShipping_ID", TShipping_ID)>

<!--- instancier un objet de type (class) TableDataInsertAllRequest.Rows --->
<cfobject action="create" type="java" class="com.google.api.services.bigquery.model.TableDataInsertAllRequest$Rows" name="rows">
<cfdump var="#rows#">

<!--- instancier un objet de type (class) TableDataInsertAllRequest --->
<cfobject action="create" type="java" class="java.lang.System" name="sys">
<cfdump var="#sys#">

<cfset rows.setInsertId(sys.currentTimeMillis())>
<cfset rows.setJson(row)>

<!--- instancier un objet de type (class) ArrayList --->
<cfobject action="create" type="java" class="java.util.ArrayList" name="rowList">
<cfdump var="#rowList#">
<cfset rowList.add(rows)>

<!--- instancier un objet de type (class) TableDataInsertAllRequest --->
<cfobject action="create" type="java" class="com.google.api.services.bigquery.model.TableDataInsertAllRequest" name="rqst">
<cfdump var="#rqst#">
<cfset content=rqst.setRows(rowList)>


<!--- instancier un objet de type (class) TableDataInsertAllResponse --->
<cfobject action="create" type="java" class="com.google.api.services.bigquery.model.TableDataInsertAllResponse" name="rsp">
<cfdump var="#rsp#">
<cfset response = bq.tabledata().insertAll("vigicolis", "wi_vigicolis", "TShipping", content).execute()>
</cfloop>









share|improve this question




























    up vote
    2
    down vote

    favorite












    I want to know the best way (best performance and reaction time) to insert all rows of an SQL table into a Google BigQuery table. Actually, I am looping over a query result and insert the rows one by one into the BigQuery table.



    The query GetShippingList returns all TShipping_ID of the table Shipping which has only one column:TShipping_ID. So, the SQL table has exactly the same schema of the BigQuery table.



    <cfloop query="GetShippingList">
    <cfset DateTime=mid("#now()#",6,19)>
    <cfset TShipping_ID=TShipping_ID>

    <!--- instancier un objet de type (class) TableRow --->
    <cfobject action="create" type="java" class="com.google.api.services.bigquery.model.TableRow" name="row">
    <cfset row.set("DateTime",DateTime)>
    <cfset row.set("TShipping_ID", TShipping_ID)>

    <!--- instancier un objet de type (class) TableDataInsertAllRequest.Rows --->
    <cfobject action="create" type="java" class="com.google.api.services.bigquery.model.TableDataInsertAllRequest$Rows" name="rows">
    <cfdump var="#rows#">

    <!--- instancier un objet de type (class) TableDataInsertAllRequest --->
    <cfobject action="create" type="java" class="java.lang.System" name="sys">
    <cfdump var="#sys#">

    <cfset rows.setInsertId(sys.currentTimeMillis())>
    <cfset rows.setJson(row)>

    <!--- instancier un objet de type (class) ArrayList --->
    <cfobject action="create" type="java" class="java.util.ArrayList" name="rowList">
    <cfdump var="#rowList#">
    <cfset rowList.add(rows)>

    <!--- instancier un objet de type (class) TableDataInsertAllRequest --->
    <cfobject action="create" type="java" class="com.google.api.services.bigquery.model.TableDataInsertAllRequest" name="rqst">
    <cfdump var="#rqst#">
    <cfset content=rqst.setRows(rowList)>


    <!--- instancier un objet de type (class) TableDataInsertAllResponse --->
    <cfobject action="create" type="java" class="com.google.api.services.bigquery.model.TableDataInsertAllResponse" name="rsp">
    <cfdump var="#rsp#">
    <cfset response = bq.tabledata().insertAll("vigicolis", "wi_vigicolis", "TShipping", content).execute()>
    </cfloop>









    share|improve this question


























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I want to know the best way (best performance and reaction time) to insert all rows of an SQL table into a Google BigQuery table. Actually, I am looping over a query result and insert the rows one by one into the BigQuery table.



      The query GetShippingList returns all TShipping_ID of the table Shipping which has only one column:TShipping_ID. So, the SQL table has exactly the same schema of the BigQuery table.



      <cfloop query="GetShippingList">
      <cfset DateTime=mid("#now()#",6,19)>
      <cfset TShipping_ID=TShipping_ID>

      <!--- instancier un objet de type (class) TableRow --->
      <cfobject action="create" type="java" class="com.google.api.services.bigquery.model.TableRow" name="row">
      <cfset row.set("DateTime",DateTime)>
      <cfset row.set("TShipping_ID", TShipping_ID)>

      <!--- instancier un objet de type (class) TableDataInsertAllRequest.Rows --->
      <cfobject action="create" type="java" class="com.google.api.services.bigquery.model.TableDataInsertAllRequest$Rows" name="rows">
      <cfdump var="#rows#">

      <!--- instancier un objet de type (class) TableDataInsertAllRequest --->
      <cfobject action="create" type="java" class="java.lang.System" name="sys">
      <cfdump var="#sys#">

      <cfset rows.setInsertId(sys.currentTimeMillis())>
      <cfset rows.setJson(row)>

      <!--- instancier un objet de type (class) ArrayList --->
      <cfobject action="create" type="java" class="java.util.ArrayList" name="rowList">
      <cfdump var="#rowList#">
      <cfset rowList.add(rows)>

      <!--- instancier un objet de type (class) TableDataInsertAllRequest --->
      <cfobject action="create" type="java" class="com.google.api.services.bigquery.model.TableDataInsertAllRequest" name="rqst">
      <cfdump var="#rqst#">
      <cfset content=rqst.setRows(rowList)>


      <!--- instancier un objet de type (class) TableDataInsertAllResponse --->
      <cfobject action="create" type="java" class="com.google.api.services.bigquery.model.TableDataInsertAllResponse" name="rsp">
      <cfdump var="#rsp#">
      <cfset response = bq.tabledata().insertAll("vigicolis", "wi_vigicolis", "TShipping", content).execute()>
      </cfloop>









      share|improve this question















      I want to know the best way (best performance and reaction time) to insert all rows of an SQL table into a Google BigQuery table. Actually, I am looping over a query result and insert the rows one by one into the BigQuery table.



      The query GetShippingList returns all TShipping_ID of the table Shipping which has only one column:TShipping_ID. So, the SQL table has exactly the same schema of the BigQuery table.



      <cfloop query="GetShippingList">
      <cfset DateTime=mid("#now()#",6,19)>
      <cfset TShipping_ID=TShipping_ID>

      <!--- instancier un objet de type (class) TableRow --->
      <cfobject action="create" type="java" class="com.google.api.services.bigquery.model.TableRow" name="row">
      <cfset row.set("DateTime",DateTime)>
      <cfset row.set("TShipping_ID", TShipping_ID)>

      <!--- instancier un objet de type (class) TableDataInsertAllRequest.Rows --->
      <cfobject action="create" type="java" class="com.google.api.services.bigquery.model.TableDataInsertAllRequest$Rows" name="rows">
      <cfdump var="#rows#">

      <!--- instancier un objet de type (class) TableDataInsertAllRequest --->
      <cfobject action="create" type="java" class="java.lang.System" name="sys">
      <cfdump var="#sys#">

      <cfset rows.setInsertId(sys.currentTimeMillis())>
      <cfset rows.setJson(row)>

      <!--- instancier un objet de type (class) ArrayList --->
      <cfobject action="create" type="java" class="java.util.ArrayList" name="rowList">
      <cfdump var="#rowList#">
      <cfset rowList.add(rows)>

      <!--- instancier un objet de type (class) TableDataInsertAllRequest --->
      <cfobject action="create" type="java" class="com.google.api.services.bigquery.model.TableDataInsertAllRequest" name="rqst">
      <cfdump var="#rqst#">
      <cfset content=rqst.setRows(rowList)>


      <!--- instancier un objet de type (class) TableDataInsertAllResponse --->
      <cfobject action="create" type="java" class="com.google.api.services.bigquery.model.TableDataInsertAllResponse" name="rsp">
      <cfdump var="#rsp#">
      <cfset response = bq.tabledata().insertAll("vigicolis", "wi_vigicolis", "TShipping", content).execute()>
      </cfloop>






      sql-server coldfusion cfml google-bigquery






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 34 mins ago









      200_success

      127k15149412




      127k15149412










      asked May 9 '14 at 13:59









      user3569267

      1261




      1261



























          active

          oldest

          votes











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "196"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f49335%2finsert-all-sql-server-table-rows-in-a-google-bigquery-table%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Code Review Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f49335%2finsert-all-sql-server-table-rows-in-a-google-bigquery-table%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          404 Error Contact Form 7 ajax form submitting

          How to know if a Active Directory user can login interactively

          TypeError: fit_transform() missing 1 required positional argument: 'X'