Skip to content

Commit

Permalink
Fix PyLint + Flakes8
Browse files Browse the repository at this point in the history
  • Loading branch information
mlabarrere committed Dec 26, 2020
1 parent 45b4e3a commit ebdc1bc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
11 changes: 10 additions & 1 deletion pygquery/BigQueryReader.py → pygquery/bigquery_reader.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
"""BigQueryReader
Reads a query
"""

from threading import Thread
from google.cloud import bigquery
from google.oauth2.service_account import Credentials


class BigQueryReader(Thread):
"""BigQueryReader
Reads a query
"""
def __init__(self, request, project, api_key_path):
"""Object Configuration"""
Thread.__init__(self)
Expand All @@ -27,9 +35,10 @@ def __init__(self, request, project, api_key_path):
raise RuntimeError(self._query_job.errors)

def run(self):

"""Start thread"""
self._data = self._query_job.to_dataframe()

@property
def data(self):
"""return data"""
return self._data
12 changes: 8 additions & 4 deletions pygquery/BigQueryWriter.py → pygquery/bigquery_writer.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
"""BigQueryWriter
Writes a query
"""

from threading import Thread
from google.cloud import bigquery
from google.oauth2.service_account import Credentials

lass BigQueryWriter(Thread):

class BigQueryWriter(Thread):
"""Reads Query"""
def __init__(self, dataframe, project, dataset, table, if_exists,
api_key_path):
"""Object Configuration"""
Thread.__init__(self)
"""Client Configuration"""
credentials = Credentials.from_service_account_file(api_key_path)

_client = bigquery.Client(credentials=credentials, project=project)

dataset_ref = _client.dataset(dataset)
Expand All @@ -32,5 +36,5 @@ def __init__(self, dataframe, project, dataset, table, if_exists,
job_config=_job_config)

def run(self):

"""starts writing data"""
self._query_job.result()

0 comments on commit ebdc1bc

Please sign in to comment.