Q:

Multiple data set into the same table id with BigQuery.

I would like to be able to update my data table like this :

Each one of the 608 update represent a date :

So basically my jobSpec is like this :
  var jobSpec = {
    configuration: {
      load: {
        destinationTable: {
          projectId: projectId,
          datasetId: 'Facebook',
          tableId: tableId
        },
        allowJaggedRows: true,
        writeDisposition: 'WRITE_TRUNCATE',
        schema: {
          fields: [
        {name: 'Page_ID', type: 'STRING'},
        {name: 'Post_ID', type: 'STRING'},
        {name: 'Post_creation_date', type: 'STRING'},
        {name: 'Post_name', type: 'STRING'},
        {name: 'Post_message', type: 'STRING'}
          ]
        }
      }
    }
  };

and here is my job :
BigQuery.Jobs.insert(jobSpec, projectId, data);

I tried to remplace 'WRITE_TRUNCATE' by 'WRITE_APPEND' but it's merging all my update. I would like to keep track of them as I shown in my screenshot.
Thanks !

A:

Not sure if I fully understood your question but in order to create tables like the ga_sessions all you have to do is to create tables with the same prefix and just change some identification for them.
For instance, if you go to your BigQuery WebUI and create a table called "test_1" and then create another one just like the first but named "test_2" you will see the same result as in ga_sessions (but this time you will see test_(2)).
If you want to use the API, you'd have to do something like:
BigQuery.Jobs.insert(jobSpec, projectId, data, table_id='test_1');
BigQuery.Jobs.insert(jobSpec, projectId, data, table_id='test_2');

So it's not the "write_append" nor the "write_truncate" that you should be changing but rather the table's name.
This type of partitioning is more "manual" and you are the one resposible for creating the different tables.
BigQuery offers a more automatic option as well, which is a partitioned table. This type of table is a bit different from the ga_sessions in the sense that all you will have is just one table. And all data inserted in this table say in day 28 April will be allocated automatically to this timestamp. If next day you insert more data, it automatically is allocated to the timestamp 29 April and so on.
Later on to query your data you can use the _PARTITIONTIME to select only the desired timestamp.
It's a matter of identifying which one makes more sense to you in your project.

