Skip to content
This repository has been archived by the owner on Dec 20, 2021. It is now read-only.

Commit

Permalink
new table
Browse files Browse the repository at this point in the history
  • Loading branch information
Nico-ehs committed Aug 18, 2017
1 parent a9a4500 commit 53185f0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 204 deletions.
12 changes: 0 additions & 12 deletions PythonVanityTest-4073c8620c48.json

This file was deleted.

35 changes: 35 additions & 0 deletions bigquery.py
@@ -0,0 +1,35 @@
from google.cloud import bigquery




def run_query_sql(query, auth):
client=bigquery.Client.from_service_account_json(auth)
query_results = client.run_sync_query(query)

query_results.run()

rows = query_results.fetch_data(max_results=20)

for row in rows:
print("{} {}".format(row[0],row[1]))
# print(row)

def package_downloads(name,auth):
query="""
SELECT
file_version,
SUM(total_downloads) as downloads
FROM [python-vanity-test:Download_Data.file_counts]
WHERE
file_project='{}'
GROUP BY
file_version
ORDER BY
file_version
""".format(name)
run_query_sql(query, auth)

# Replace 'Python Vanity Test-125254b19f45.json' with own credentials
if __name__ == '__main__':
package_downloads("vanity",'Python Vanity Test-125254b19f45.json')
192 changes: 0 additions & 192 deletions bigquery_tests.py

This file was deleted.

0 comments on commit 53185f0

Please sign in to comment.