2

I need to access to those properties google big query ui provides like table size, number of rows etc... However I couldn't find any documentation or reference for that.

Table ID    xxxx:xx.xxx
Table Size  133 KB
Number of Rows  250
Creation Time   9:48am, 2 Jan 2015
Last Modified   12:40am, 3 Jan 2015

Also for some table even the UI does not provide number of rows and it looks like the following. Any reason for it?

Table ID    yyyy.yyyy
Creation Time   4:51pm, 6 Jan 2015
Last Modified   6:07pm, 6 Jan 2015
Dharmesh Porwal
  • 1,406
  • 2
  • 12
  • 21
East2West
  • 657
  • 1
  • 6
  • 22
  • I've noticed Jordan provided a way of getting metadata of tables and I assume that's the only way; http://stackoverflow.com/questions/22734777/how-do-i-use-the-table-query-function-in-bigquery/22735031#22735031 When I use the following statement, it shows 0 rows for some tables though there at least few rows project: test-altar-543 and query: SELECT * FROM sandbox.__TABLES__ test table has 5 rows, but query returns 0 on row_count column – East2West Jan 07 '15 at 04:58

2 Answers2

2

Tables that have received streaming inserts recently do not provide row/size attributes as this data is prone to change frequently. Once the table is no longer consider an active streaming table this data should be available.

This information is made available via the tables.get API call.

shollyman
  • 4,216
  • 19
  • 17
1

you can get this data with the Java Sdk from

com.google.api.services.bigquery.model.Table

you can get it by doing the following code:

    Bigquery.Tables.Get tableGet = bigquery
            .tables().get(
                    projectId,
                    datasetID,
                   tablId);

    Table t = tableGet.execute();

please contact me if you have more questions

Yonihu
  • 171
  • 1
  • 1
  • 6
  • Can I get that information if it is a View? If so, how does that work when particularly more than one table referenced by a view? – East2West Jan 06 '16 at 19:36