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>
sql-server coldfusion cfml google-bigquery
add a comment |
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>
sql-server coldfusion cfml google-bigquery
add a comment |
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>
sql-server coldfusion cfml google-bigquery
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
sql-server coldfusion cfml google-bigquery
edited 34 mins ago
200_success
127k15149412
127k15149412
asked May 9 '14 at 13:59
user3569267
1261
1261
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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