问题
Suppose you have a Google-BigQuery project per Client. Now a new Client is coming aboard. What is the best procedure to clone a project, a dataset or an object like a view to a new project?
I have a dataset with a set of views containing analytics logic. It would be great if I could copy those views to the new project.
Thanks
回答1:
as an option - you can have script that
- take list of all views in your master dataset with Tables: list API
- loops through all views (check type property) in list response and
- for each view read with Tables: get API view definition and other relevant properties and
- then create with Tables: insert API respective view in new dataset
Should be pretty simple
回答2:
We had similar requirement to transfer all or selective Views and Table definitions from One Big Query project to another per Dataset level, Hence have coded in-house to transfer all/selective tables Schemas and Views Definitions using Biq Query APIs. It is shallow cloning(no table data transferred) to destination Big Query project.
Feel free to ask for code example if you still need it. I will be happy to share my Java Code.
来源:https://stackoverflow.com/questions/38490166/how-to-clone-a-dataset-to-another-bigquery-project