partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
test
GoogleCloudStorageHook.get_conn
Returns a Google Cloud Storage service object.
airflow/contrib/hooks/gcs_hook.py
def get_conn(self): """ Returns a Google Cloud Storage service object. """ if not self._conn: self._conn = storage.Client(credentials=self._get_credentials()) return self._conn
def get_conn(self): """ Returns a Google Cloud Storage service object. """ if not self._conn: self._conn = storage.Client(credentials=self._get_credentials()) return self._conn
[ "Returns", "a", "Google", "Cloud", "Storage", "service", "object", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L45-L52
[ "def", "get_conn", "(", "self", ")", ":", "if", "not", "self", ".", "_conn", ":", "self", ".", "_conn", "=", "storage", ".", "Client", "(", "credentials", "=", "self", ".", "_get_credentials", "(", ")", ")", "return", "self", ".", "_conn" ]
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
GoogleCloudStorageHook.copy
Copies an object from a bucket to another, with renaming if requested. destination_bucket or destination_object can be omitted, in which case source bucket/object is used, but not both. :param source_bucket: The bucket of the object to copy from. :type source_bucket: str :param...
airflow/contrib/hooks/gcs_hook.py
def copy(self, source_bucket, source_object, destination_bucket=None, destination_object=None): """ Copies an object from a bucket to another, with renaming if requested. destination_bucket or destination_object can be omitted, in which case source bucket/object is used, bu...
def copy(self, source_bucket, source_object, destination_bucket=None, destination_object=None): """ Copies an object from a bucket to another, with renaming if requested. destination_bucket or destination_object can be omitted, in which case source bucket/object is used, bu...
[ "Copies", "an", "object", "from", "a", "bucket", "to", "another", "with", "renaming", "if", "requested", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L54-L96
[ "def", "copy", "(", "self", ",", "source_bucket", ",", "source_object", ",", "destination_bucket", "=", "None", ",", "destination_object", "=", "None", ")", ":", "destination_bucket", "=", "destination_bucket", "or", "source_bucket", "destination_object", "=", "dest...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
GoogleCloudStorageHook.rewrite
Has the same functionality as copy, except that will work on files over 5 TB, as well as when copying between locations and/or storage classes. destination_object can be omitted, in which case source_object is used. :param source_bucket: The bucket of the object to copy from. :...
airflow/contrib/hooks/gcs_hook.py
def rewrite(self, source_bucket, source_object, destination_bucket, destination_object=None): """ Has the same functionality as copy, except that will work on files over 5 TB, as well as when copying between locations and/or storage classes. destination_object ca...
def rewrite(self, source_bucket, source_object, destination_bucket, destination_object=None): """ Has the same functionality as copy, except that will work on files over 5 TB, as well as when copying between locations and/or storage classes. destination_object ca...
[ "Has", "the", "same", "functionality", "as", "copy", "except", "that", "will", "work", "on", "files", "over", "5", "TB", "as", "well", "as", "when", "copying", "between", "locations", "and", "/", "or", "storage", "classes", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L98-L150
[ "def", "rewrite", "(", "self", ",", "source_bucket", ",", "source_object", ",", "destination_bucket", ",", "destination_object", "=", "None", ")", ":", "destination_object", "=", "destination_object", "or", "source_object", "if", "(", "source_bucket", "==", "destina...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
GoogleCloudStorageHook.download
Get a file from Google Cloud Storage. :param bucket_name: The bucket to fetch from. :type bucket_name: str :param object_name: The object to fetch. :type object_name: str :param filename: If set, a local file path where the file should be written to. :type filename: str
airflow/contrib/hooks/gcs_hook.py
def download(self, bucket_name, object_name, filename=None): """ Get a file from Google Cloud Storage. :param bucket_name: The bucket to fetch from. :type bucket_name: str :param object_name: The object to fetch. :type object_name: str :param filename: If set, a ...
def download(self, bucket_name, object_name, filename=None): """ Get a file from Google Cloud Storage. :param bucket_name: The bucket to fetch from. :type bucket_name: str :param object_name: The object to fetch. :type object_name: str :param filename: If set, a ...
[ "Get", "a", "file", "from", "Google", "Cloud", "Storage", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L152-L171
[ "def", "download", "(", "self", ",", "bucket_name", ",", "object_name", ",", "filename", "=", "None", ")", ":", "client", "=", "self", ".", "get_conn", "(", ")", "bucket", "=", "client", ".", "get_bucket", "(", "bucket_name", ")", "blob", "=", "bucket", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
GoogleCloudStorageHook.upload
Uploads a local file to Google Cloud Storage. :param bucket_name: The bucket to upload to. :type bucket_name: str :param object_name: The object name to set when uploading the local file. :type object_name: str :param filename: The local file path to the file to be uploaded. ...
airflow/contrib/hooks/gcs_hook.py
def upload(self, bucket_name, object_name, filename, mime_type='application/octet-stream', gzip=False): """ Uploads a local file to Google Cloud Storage. :param bucket_name: The bucket to upload to. :type bucket_name: str :param object_name: The object name to set...
def upload(self, bucket_name, object_name, filename, mime_type='application/octet-stream', gzip=False): """ Uploads a local file to Google Cloud Storage. :param bucket_name: The bucket to upload to. :type bucket_name: str :param object_name: The object name to set...
[ "Uploads", "a", "local", "file", "to", "Google", "Cloud", "Storage", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L173-L206
[ "def", "upload", "(", "self", ",", "bucket_name", ",", "object_name", ",", "filename", ",", "mime_type", "=", "'application/octet-stream'", ",", "gzip", "=", "False", ")", ":", "if", "gzip", ":", "filename_gz", "=", "filename", "+", "'.gz'", "with", "open", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
GoogleCloudStorageHook.exists
Checks for the existence of a file in Google Cloud Storage. :param bucket_name: The Google cloud storage bucket where the object is. :type bucket_name: str :param object_name: The name of the blob_name to check in the Google cloud storage bucket. :type object_name: str
airflow/contrib/hooks/gcs_hook.py
def exists(self, bucket_name, object_name): """ Checks for the existence of a file in Google Cloud Storage. :param bucket_name: The Google cloud storage bucket where the object is. :type bucket_name: str :param object_name: The name of the blob_name to check in the Google cloud ...
def exists(self, bucket_name, object_name): """ Checks for the existence of a file in Google Cloud Storage. :param bucket_name: The Google cloud storage bucket where the object is. :type bucket_name: str :param object_name: The name of the blob_name to check in the Google cloud ...
[ "Checks", "for", "the", "existence", "of", "a", "file", "in", "Google", "Cloud", "Storage", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L208-L221
[ "def", "exists", "(", "self", ",", "bucket_name", ",", "object_name", ")", ":", "client", "=", "self", ".", "get_conn", "(", ")", "bucket", "=", "client", ".", "get_bucket", "(", "bucket_name", "=", "bucket_name", ")", "blob", "=", "bucket", ".", "blob",...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
GoogleCloudStorageHook.is_updated_after
Checks if an blob_name is updated in Google Cloud Storage. :param bucket_name: The Google cloud storage bucket where the object is. :type bucket_name: str :param object_name: The name of the object to check in the Google cloud storage bucket. :type object_name: str :...
airflow/contrib/hooks/gcs_hook.py
def is_updated_after(self, bucket_name, object_name, ts): """ Checks if an blob_name is updated in Google Cloud Storage. :param bucket_name: The Google cloud storage bucket where the object is. :type bucket_name: str :param object_name: The name of the object to check in the Goo...
def is_updated_after(self, bucket_name, object_name, ts): """ Checks if an blob_name is updated in Google Cloud Storage. :param bucket_name: The Google cloud storage bucket where the object is. :type bucket_name: str :param object_name: The name of the object to check in the Goo...
[ "Checks", "if", "an", "blob_name", "is", "updated", "in", "Google", "Cloud", "Storage", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L223-L253
[ "def", "is_updated_after", "(", "self", ",", "bucket_name", ",", "object_name", ",", "ts", ")", ":", "client", "=", "self", ".", "get_conn", "(", ")", "bucket", "=", "storage", ".", "Bucket", "(", "client", "=", "client", ",", "name", "=", "bucket_name",...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
GoogleCloudStorageHook.delete
Deletes an object from the bucket. :param bucket_name: name of the bucket, where the object resides :type bucket_name: str :param object_name: name of the object to delete :type object_name: str
airflow/contrib/hooks/gcs_hook.py
def delete(self, bucket_name, object_name): """ Deletes an object from the bucket. :param bucket_name: name of the bucket, where the object resides :type bucket_name: str :param object_name: name of the object to delete :type object_name: str """ client =...
def delete(self, bucket_name, object_name): """ Deletes an object from the bucket. :param bucket_name: name of the bucket, where the object resides :type bucket_name: str :param object_name: name of the object to delete :type object_name: str """ client =...
[ "Deletes", "an", "object", "from", "the", "bucket", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L255-L269
[ "def", "delete", "(", "self", ",", "bucket_name", ",", "object_name", ")", ":", "client", "=", "self", ".", "get_conn", "(", ")", "bucket", "=", "client", ".", "get_bucket", "(", "bucket_name", "=", "bucket_name", ")", "blob", "=", "bucket", ".", "blob",...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
GoogleCloudStorageHook.list
List all objects from the bucket with the give string prefix in name :param bucket_name: bucket name :type bucket_name: str :param versions: if true, list all versions of the objects :type versions: bool :param max_results: max count of items to return in a single page of respon...
airflow/contrib/hooks/gcs_hook.py
def list(self, bucket_name, versions=None, max_results=None, prefix=None, delimiter=None): """ List all objects from the bucket with the give string prefix in name :param bucket_name: bucket name :type bucket_name: str :param versions: if true, list all versions of the objects ...
def list(self, bucket_name, versions=None, max_results=None, prefix=None, delimiter=None): """ List all objects from the bucket with the give string prefix in name :param bucket_name: bucket name :type bucket_name: str :param versions: if true, list all versions of the objects ...
[ "List", "all", "objects", "from", "the", "bucket", "with", "the", "give", "string", "prefix", "in", "name" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L271-L316
[ "def", "list", "(", "self", ",", "bucket_name", ",", "versions", "=", "None", ",", "max_results", "=", "None", ",", "prefix", "=", "None", ",", "delimiter", "=", "None", ")", ":", "client", "=", "self", ".", "get_conn", "(", ")", "bucket", "=", "clie...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
GoogleCloudStorageHook.get_size
Gets the size of a file in Google Cloud Storage. :param bucket_name: The Google cloud storage bucket where the blob_name is. :type bucket_name: str :param object_name: The name of the object to check in the Google cloud storage bucket_name. :type object_name: str
airflow/contrib/hooks/gcs_hook.py
def get_size(self, bucket_name, object_name): """ Gets the size of a file in Google Cloud Storage. :param bucket_name: The Google cloud storage bucket where the blob_name is. :type bucket_name: str :param object_name: The name of the object to check in the Google clo...
def get_size(self, bucket_name, object_name): """ Gets the size of a file in Google Cloud Storage. :param bucket_name: The Google cloud storage bucket where the blob_name is. :type bucket_name: str :param object_name: The name of the object to check in the Google clo...
[ "Gets", "the", "size", "of", "a", "file", "in", "Google", "Cloud", "Storage", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L318-L338
[ "def", "get_size", "(", "self", ",", "bucket_name", ",", "object_name", ")", ":", "self", ".", "log", ".", "info", "(", "'Checking the file size of object: %s in bucket_name: %s'", ",", "object_name", ",", "bucket_name", ")", "client", "=", "self", ".", "get_conn"...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
GoogleCloudStorageHook.get_crc32c
Gets the CRC32c checksum of an object in Google Cloud Storage. :param bucket_name: The Google cloud storage bucket where the blob_name is. :type bucket_name: str :param object_name: The name of the object to check in the Google cloud storage bucket_name. :type object_name: s...
airflow/contrib/hooks/gcs_hook.py
def get_crc32c(self, bucket_name, object_name): """ Gets the CRC32c checksum of an object in Google Cloud Storage. :param bucket_name: The Google cloud storage bucket where the blob_name is. :type bucket_name: str :param object_name: The name of the object to check in the Google...
def get_crc32c(self, bucket_name, object_name): """ Gets the CRC32c checksum of an object in Google Cloud Storage. :param bucket_name: The Google cloud storage bucket where the blob_name is. :type bucket_name: str :param object_name: The name of the object to check in the Google...
[ "Gets", "the", "CRC32c", "checksum", "of", "an", "object", "in", "Google", "Cloud", "Storage", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L340-L358
[ "def", "get_crc32c", "(", "self", ",", "bucket_name", ",", "object_name", ")", ":", "self", ".", "log", ".", "info", "(", "'Retrieving the crc32c checksum of '", "'object_name: %s in bucket_name: %s'", ",", "object_name", ",", "bucket_name", ")", "client", "=", "sel...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
GoogleCloudStorageHook.get_md5hash
Gets the MD5 hash of an object in Google Cloud Storage. :param bucket_name: The Google cloud storage bucket where the blob_name is. :type bucket_name: str :param object_name: The name of the object to check in the Google cloud storage bucket_name. :type object_name: str
airflow/contrib/hooks/gcs_hook.py
def get_md5hash(self, bucket_name, object_name): """ Gets the MD5 hash of an object in Google Cloud Storage. :param bucket_name: The Google cloud storage bucket where the blob_name is. :type bucket_name: str :param object_name: The name of the object to check in the Google cloud...
def get_md5hash(self, bucket_name, object_name): """ Gets the MD5 hash of an object in Google Cloud Storage. :param bucket_name: The Google cloud storage bucket where the blob_name is. :type bucket_name: str :param object_name: The name of the object to check in the Google cloud...
[ "Gets", "the", "MD5", "hash", "of", "an", "object", "in", "Google", "Cloud", "Storage", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L360-L378
[ "def", "get_md5hash", "(", "self", ",", "bucket_name", ",", "object_name", ")", ":", "self", ".", "log", ".", "info", "(", "'Retrieving the MD5 hash of '", "'object: %s in bucket: %s'", ",", "object_name", ",", "bucket_name", ")", "client", "=", "self", ".", "ge...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
GoogleCloudStorageHook.create_bucket
Creates a new bucket. Google Cloud Storage uses a flat namespace, so you can't create a bucket with a name that is already in use. .. seealso:: For more information, see Bucket Naming Guidelines: https://cloud.google.com/storage/docs/bucketnaming.html#requirements :para...
airflow/contrib/hooks/gcs_hook.py
def create_bucket(self, bucket_name, resource=None, storage_class='MULTI_REGIONAL', location='US', project_id=None, labels=None ): """ Creates a new b...
def create_bucket(self, bucket_name, resource=None, storage_class='MULTI_REGIONAL', location='US', project_id=None, labels=None ): """ Creates a new b...
[ "Creates", "a", "new", "bucket", ".", "Google", "Cloud", "Storage", "uses", "a", "flat", "namespace", "so", "you", "can", "t", "create", "a", "bucket", "with", "a", "name", "that", "is", "already", "in", "use", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L382-L445
[ "def", "create_bucket", "(", "self", ",", "bucket_name", ",", "resource", "=", "None", ",", "storage_class", "=", "'MULTI_REGIONAL'", ",", "location", "=", "'US'", ",", "project_id", "=", "None", ",", "labels", "=", "None", ")", ":", "self", ".", "log", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
GoogleCloudStorageHook.insert_bucket_acl
Creates a new ACL entry on the specified bucket_name. See: https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/insert :param bucket_name: Name of a bucket_name. :type bucket_name: str :param entity: The entity holding the permission, in one of the following forms: ...
airflow/contrib/hooks/gcs_hook.py
def insert_bucket_acl(self, bucket_name, entity, role, user_project=None): """ Creates a new ACL entry on the specified bucket_name. See: https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/insert :param bucket_name: Name of a bucket_name. :type bucket_name: s...
def insert_bucket_acl(self, bucket_name, entity, role, user_project=None): """ Creates a new ACL entry on the specified bucket_name. See: https://cloud.google.com/storage/docs/json_api/v1/bucketAccessControls/insert :param bucket_name: Name of a bucket_name. :type bucket_name: s...
[ "Creates", "a", "new", "ACL", "entry", "on", "the", "specified", "bucket_name", ".", "See", ":", "https", ":", "//", "cloud", ".", "google", ".", "com", "/", "storage", "/", "docs", "/", "json_api", "/", "v1", "/", "bucketAccessControls", "/", "insert" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L447-L475
[ "def", "insert_bucket_acl", "(", "self", ",", "bucket_name", ",", "entity", ",", "role", ",", "user_project", "=", "None", ")", ":", "self", ".", "log", ".", "info", "(", "'Creating a new ACL entry in bucket: %s'", ",", "bucket_name", ")", "client", "=", "self...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
GoogleCloudStorageHook.insert_object_acl
Creates a new ACL entry on the specified object. See: https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/insert :param bucket_name: Name of a bucket_name. :type bucket_name: str :param object_name: Name of the object. For information about how to URL encode ...
airflow/contrib/hooks/gcs_hook.py
def insert_object_acl(self, bucket_name, object_name, entity, role, user_project=None): """ Creates a new ACL entry on the specified object. See: https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/insert :param bucket_name: Name of a bucket_name. :type bucket...
def insert_object_acl(self, bucket_name, object_name, entity, role, user_project=None): """ Creates a new ACL entry on the specified object. See: https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/insert :param bucket_name: Name of a bucket_name. :type bucket...
[ "Creates", "a", "new", "ACL", "entry", "on", "the", "specified", "object", ".", "See", ":", "https", ":", "//", "cloud", ".", "google", ".", "com", "/", "storage", "/", "docs", "/", "json_api", "/", "v1", "/", "objectAccessControls", "/", "insert" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L477-L513
[ "def", "insert_object_acl", "(", "self", ",", "bucket_name", ",", "object_name", ",", "entity", ",", "role", ",", "user_project", "=", "None", ")", ":", "self", ".", "log", ".", "info", "(", "'Creating a new ACL entry for object: %s in bucket: %s'", ",", "object_n...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
GoogleCloudStorageHook.compose
Composes a list of existing object into a new object in the same storage bucket_name Currently it only supports up to 32 objects that can be concatenated in a single operation https://cloud.google.com/storage/docs/json_api/v1/objects/compose :param bucket_name: The name of the bucket ...
airflow/contrib/hooks/gcs_hook.py
def compose(self, bucket_name, source_objects, destination_object): """ Composes a list of existing object into a new object in the same storage bucket_name Currently it only supports up to 32 objects that can be concatenated in a single operation https://cloud.google.com/stora...
def compose(self, bucket_name, source_objects, destination_object): """ Composes a list of existing object into a new object in the same storage bucket_name Currently it only supports up to 32 objects that can be concatenated in a single operation https://cloud.google.com/stora...
[ "Composes", "a", "list", "of", "existing", "object", "into", "a", "new", "object", "in", "the", "same", "storage", "bucket_name" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L515-L550
[ "def", "compose", "(", "self", ",", "bucket_name", ",", "source_objects", ",", "destination_object", ")", ":", "if", "not", "source_objects", "or", "not", "len", "(", "source_objects", ")", ":", "raise", "ValueError", "(", "'source_objects cannot be empty.'", ")",...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
argmin
Return the index, i, in arr that minimizes f(arr[i])
airflow/contrib/hooks/sagemaker_hook.py
def argmin(arr, f): """Return the index, i, in arr that minimizes f(arr[i])""" m = None i = None for idx, item in enumerate(arr): if item is not None: if m is None or f(item) < m: m = f(item) i = idx return i
def argmin(arr, f): """Return the index, i, in arr that minimizes f(arr[i])""" m = None i = None for idx, item in enumerate(arr): if item is not None: if m is None or f(item) < m: m = f(item) i = idx return i
[ "Return", "the", "index", "i", "in", "arr", "that", "minimizes", "f", "(", "arr", "[", "i", "]", ")" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sagemaker_hook.py#L47-L56
[ "def", "argmin", "(", "arr", ",", "f", ")", ":", "m", "=", "None", "i", "=", "None", "for", "idx", ",", "item", "in", "enumerate", "(", "arr", ")", ":", "if", "item", "is", "not", "None", ":", "if", "m", "is", "None", "or", "f", "(", "item", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
secondary_training_status_changed
Returns true if training job's secondary status message has changed. :param current_job_description: Current job description, returned from DescribeTrainingJob call. :type current_job_description: dict :param prev_job_description: Previous job description, returned from DescribeTrainingJob call. :type ...
airflow/contrib/hooks/sagemaker_hook.py
def secondary_training_status_changed(current_job_description, prev_job_description): """ Returns true if training job's secondary status message has changed. :param current_job_description: Current job description, returned from DescribeTrainingJob call. :type current_job_description: dict :param ...
def secondary_training_status_changed(current_job_description, prev_job_description): """ Returns true if training job's secondary status message has changed. :param current_job_description: Current job description, returned from DescribeTrainingJob call. :type current_job_description: dict :param ...
[ "Returns", "true", "if", "training", "job", "s", "secondary", "status", "message", "has", "changed", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sagemaker_hook.py#L59-L83
[ "def", "secondary_training_status_changed", "(", "current_job_description", ",", "prev_job_description", ")", ":", "current_secondary_status_transitions", "=", "current_job_description", ".", "get", "(", "'SecondaryStatusTransitions'", ")", "if", "current_secondary_status_transitio...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
secondary_training_status_message
Returns a string contains start time and the secondary training job status message. :param job_description: Returned response from DescribeTrainingJob call :type job_description: dict :param prev_description: Previous job description from DescribeTrainingJob call :type prev_description: dict :retu...
airflow/contrib/hooks/sagemaker_hook.py
def secondary_training_status_message(job_description, prev_description): """ Returns a string contains start time and the secondary training job status message. :param job_description: Returned response from DescribeTrainingJob call :type job_description: dict :param prev_description: Previous job...
def secondary_training_status_message(job_description, prev_description): """ Returns a string contains start time and the secondary training job status message. :param job_description: Returned response from DescribeTrainingJob call :type job_description: dict :param prev_description: Previous job...
[ "Returns", "a", "string", "contains", "start", "time", "and", "the", "secondary", "training", "job", "status", "message", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sagemaker_hook.py#L86-L117
[ "def", "secondary_training_status_message", "(", "job_description", ",", "prev_description", ")", ":", "if", "job_description", "is", "None", "or", "job_description", ".", "get", "(", "'SecondaryStatusTransitions'", ")", "is", "None", "or", "len", "(", "job_descriptio...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
SageMakerHook.tar_and_s3_upload
Tar the local file or directory and upload to s3 :param path: local file or directory :type path: str :param key: s3 key :type key: str :param bucket: s3 bucket :type bucket: str :return: None
airflow/contrib/hooks/sagemaker_hook.py
def tar_and_s3_upload(self, path, key, bucket): """ Tar the local file or directory and upload to s3 :param path: local file or directory :type path: str :param key: s3 key :type key: str :param bucket: s3 bucket :type bucket: str :return: None ...
def tar_and_s3_upload(self, path, key, bucket): """ Tar the local file or directory and upload to s3 :param path: local file or directory :type path: str :param key: s3 key :type key: str :param bucket: s3 bucket :type bucket: str :return: None ...
[ "Tar", "the", "local", "file", "or", "directory", "and", "upload", "to", "s3" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sagemaker_hook.py#L134-L155
[ "def", "tar_and_s3_upload", "(", "self", ",", "path", ",", "key", ",", "bucket", ")", ":", "with", "tempfile", ".", "TemporaryFile", "(", ")", "as", "temp_file", ":", "if", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "files", "=", "[", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
SageMakerHook.configure_s3_resources
Extract the S3 operations from the configuration and execute them. :param config: config of SageMaker operation :type config: dict :rtype: dict
airflow/contrib/hooks/sagemaker_hook.py
def configure_s3_resources(self, config): """ Extract the S3 operations from the configuration and execute them. :param config: config of SageMaker operation :type config: dict :rtype: dict """ s3_operations = config.pop('S3Operations', None) if s3_opera...
def configure_s3_resources(self, config): """ Extract the S3 operations from the configuration and execute them. :param config: config of SageMaker operation :type config: dict :rtype: dict """ s3_operations = config.pop('S3Operations', None) if s3_opera...
[ "Extract", "the", "S3", "operations", "from", "the", "configuration", "and", "execute", "them", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sagemaker_hook.py#L157-L178
[ "def", "configure_s3_resources", "(", "self", ",", "config", ")", ":", "s3_operations", "=", "config", ".", "pop", "(", "'S3Operations'", ",", "None", ")", "if", "s3_operations", "is", "not", "None", ":", "create_bucket_ops", "=", "s3_operations", ".", "get", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
SageMakerHook.check_s3_url
Check if an S3 URL exists :param s3url: S3 url :type s3url: str :rtype: bool
airflow/contrib/hooks/sagemaker_hook.py
def check_s3_url(self, s3url): """ Check if an S3 URL exists :param s3url: S3 url :type s3url: str :rtype: bool """ bucket, key = S3Hook.parse_s3_url(s3url) if not self.s3_hook.check_for_bucket(bucket_name=bucket): raise AirflowException( ...
def check_s3_url(self, s3url): """ Check if an S3 URL exists :param s3url: S3 url :type s3url: str :rtype: bool """ bucket, key = S3Hook.parse_s3_url(s3url) if not self.s3_hook.check_for_bucket(bucket_name=bucket): raise AirflowException( ...
[ "Check", "if", "an", "S3", "URL", "exists" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sagemaker_hook.py#L180-L201
[ "def", "check_s3_url", "(", "self", ",", "s3url", ")", ":", "bucket", ",", "key", "=", "S3Hook", ".", "parse_s3_url", "(", "s3url", ")", "if", "not", "self", ".", "s3_hook", ".", "check_for_bucket", "(", "bucket_name", "=", "bucket", ")", ":", "raise", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
SageMakerHook.get_log_conn
Establish an AWS connection for retrieving logs during training :rtype: CloudWatchLogs.Client
airflow/contrib/hooks/sagemaker_hook.py
def get_log_conn(self): """ Establish an AWS connection for retrieving logs during training :rtype: CloudWatchLogs.Client """ config = botocore.config.Config(retries={'max_attempts': 15}) return self.get_client_type('logs', config=config)
def get_log_conn(self): """ Establish an AWS connection for retrieving logs during training :rtype: CloudWatchLogs.Client """ config = botocore.config.Config(retries={'max_attempts': 15}) return self.get_client_type('logs', config=config)
[ "Establish", "an", "AWS", "connection", "for", "retrieving", "logs", "during", "training" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sagemaker_hook.py#L233-L240
[ "def", "get_log_conn", "(", "self", ")", ":", "config", "=", "botocore", ".", "config", ".", "Config", "(", "retries", "=", "{", "'max_attempts'", ":", "15", "}", ")", "return", "self", ".", "get_client_type", "(", "'logs'", ",", "config", "=", "config",...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
SageMakerHook.create_training_job
Create a training job :param config: the config for training :type config: dict :param wait_for_completion: if the program should keep running until job finishes :type wait_for_completion: bool :param check_interval: the time interval in seconds which the operator wi...
airflow/contrib/hooks/sagemaker_hook.py
def create_training_job(self, config, wait_for_completion=True, print_log=True, check_interval=30, max_ingestion_time=None): """ Create a training job :param config: the config for training :type config: dict :param wait_for_completion: if the program...
def create_training_job(self, config, wait_for_completion=True, print_log=True, check_interval=30, max_ingestion_time=None): """ Create a training job :param config: the config for training :type config: dict :param wait_for_completion: if the program...
[ "Create", "a", "training", "job" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sagemaker_hook.py#L325-L366
[ "def", "create_training_job", "(", "self", ",", "config", ",", "wait_for_completion", "=", "True", ",", "print_log", "=", "True", ",", "check_interval", "=", "30", ",", "max_ingestion_time", "=", "None", ")", ":", "self", ".", "check_training_config", "(", "co...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
SageMakerHook.create_tuning_job
Create a tuning job :param config: the config for tuning :type config: dict :param wait_for_completion: if the program should keep running until job finishes :type wait_for_completion: bool :param check_interval: the time interval in seconds which the operator will c...
airflow/contrib/hooks/sagemaker_hook.py
def create_tuning_job(self, config, wait_for_completion=True, check_interval=30, max_ingestion_time=None): """ Create a tuning job :param config: the config for tuning :type config: dict :param wait_for_completion: if the program should keep running unt...
def create_tuning_job(self, config, wait_for_completion=True, check_interval=30, max_ingestion_time=None): """ Create a tuning job :param config: the config for tuning :type config: dict :param wait_for_completion: if the program should keep running unt...
[ "Create", "a", "tuning", "job" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sagemaker_hook.py#L368-L396
[ "def", "create_tuning_job", "(", "self", ",", "config", ",", "wait_for_completion", "=", "True", ",", "check_interval", "=", "30", ",", "max_ingestion_time", "=", "None", ")", ":", "self", ".", "check_tuning_config", "(", "config", ")", "response", "=", "self"...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
SageMakerHook.create_transform_job
Create a transform job :param config: the config for transform job :type config: dict :param wait_for_completion: if the program should keep running until job finishes :type wait_for_completion: bool :param check_interval: the time interval in seconds which the operator ...
airflow/contrib/hooks/sagemaker_hook.py
def create_transform_job(self, config, wait_for_completion=True, check_interval=30, max_ingestion_time=None): """ Create a transform job :param config: the config for transform job :type config: dict :param wait_for_completion: if the program should ...
def create_transform_job(self, config, wait_for_completion=True, check_interval=30, max_ingestion_time=None): """ Create a transform job :param config: the config for transform job :type config: dict :param wait_for_completion: if the program should ...
[ "Create", "a", "transform", "job" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sagemaker_hook.py#L398-L426
[ "def", "create_transform_job", "(", "self", ",", "config", ",", "wait_for_completion", "=", "True", ",", "check_interval", "=", "30", ",", "max_ingestion_time", "=", "None", ")", ":", "self", ".", "check_s3_url", "(", "config", "[", "'TransformInput'", "]", "[...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
SageMakerHook.create_endpoint
Create an endpoint :param config: the config for endpoint :type config: dict :param wait_for_completion: if the program should keep running until job finishes :type wait_for_completion: bool :param check_interval: the time interval in seconds which the operator will ...
airflow/contrib/hooks/sagemaker_hook.py
def create_endpoint(self, config, wait_for_completion=True, check_interval=30, max_ingestion_time=None): """ Create an endpoint :param config: the config for endpoint :type config: dict :param wait_for_completion: if the program should keep running until ...
def create_endpoint(self, config, wait_for_completion=True, check_interval=30, max_ingestion_time=None): """ Create an endpoint :param config: the config for endpoint :type config: dict :param wait_for_completion: if the program should keep running until ...
[ "Create", "an", "endpoint" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sagemaker_hook.py#L450-L477
[ "def", "create_endpoint", "(", "self", ",", "config", ",", "wait_for_completion", "=", "True", ",", "check_interval", "=", "30", ",", "max_ingestion_time", "=", "None", ")", ":", "response", "=", "self", ".", "get_conn", "(", ")", ".", "create_endpoint", "("...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
SageMakerHook.describe_training_job_with_log
Return the training job info associated with job_name and print CloudWatch logs
airflow/contrib/hooks/sagemaker_hook.py
def describe_training_job_with_log(self, job_name, positions, stream_names, instance_count, state, last_description, last_describe_job_call): """ Return the training job info associated with job_name and print CloudWatch logs ...
def describe_training_job_with_log(self, job_name, positions, stream_names, instance_count, state, last_description, last_describe_job_call): """ Return the training job info associated with job_name and print CloudWatch logs ...
[ "Return", "the", "training", "job", "info", "associated", "with", "job_name", "and", "print", "CloudWatch", "logs" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sagemaker_hook.py#L519-L572
[ "def", "describe_training_job_with_log", "(", "self", ",", "job_name", ",", "positions", ",", "stream_names", ",", "instance_count", ",", "state", ",", "last_description", ",", "last_describe_job_call", ")", ":", "log_group", "=", "'/aws/sagemaker/TrainingJobs'", "if", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
SageMakerHook.check_status
Check status of a SageMaker job :param job_name: name of the job to check status :type job_name: str :param key: the key of the response dict that points to the state :type key: str :param describe_function: the function used to retrieve the status :type desc...
airflow/contrib/hooks/sagemaker_hook.py
def check_status(self, job_name, key, describe_function, check_interval, max_ingestion_time, non_terminal_states=None): """ Check status of a SageMaker job :param job_name: name of the job to check status :type job_name: str...
def check_status(self, job_name, key, describe_function, check_interval, max_ingestion_time, non_terminal_states=None): """ Check status of a SageMaker job :param job_name: name of the job to check status :type job_name: str...
[ "Check", "status", "of", "a", "SageMaker", "job" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sagemaker_hook.py#L627-L686
[ "def", "check_status", "(", "self", ",", "job_name", ",", "key", ",", "describe_function", ",", "check_interval", ",", "max_ingestion_time", ",", "non_terminal_states", "=", "None", ")", ":", "if", "not", "non_terminal_states", ":", "non_terminal_states", "=", "se...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
SageMakerHook.check_training_status_with_log
Display the logs for a given training job, optionally tailing them until the job is complete. :param job_name: name of the training job to check status and display logs for :type job_name: str :param non_terminal_states: the set of non_terminal states :type non_terminal_states: ...
airflow/contrib/hooks/sagemaker_hook.py
def check_training_status_with_log(self, job_name, non_terminal_states, failed_states, wait_for_completion, check_interval, max_ingestion_time): """ Display the logs for a given training job, optionally tailing them until the job is complete. :para...
def check_training_status_with_log(self, job_name, non_terminal_states, failed_states, wait_for_completion, check_interval, max_ingestion_time): """ Display the logs for a given training job, optionally tailing them until the job is complete. :para...
[ "Display", "the", "logs", "for", "a", "given", "training", "job", "optionally", "tailing", "them", "until", "the", "job", "is", "complete", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/sagemaker_hook.py#L688-L770
[ "def", "check_training_status_with_log", "(", "self", ",", "job_name", ",", "non_terminal_states", ",", "failed_states", ",", "wait_for_completion", ",", "check_interval", ",", "max_ingestion_time", ")", ":", "sec", "=", "0", "description", "=", "self", ".", "descri...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
DataFlowPythonOperator.execute
Execute the python dataflow job.
airflow/contrib/operators/dataflow_operator.py
def execute(self, context): """Execute the python dataflow job.""" bucket_helper = GoogleCloudBucketHelper( self.gcp_conn_id, self.delegate_to) self.py_file = bucket_helper.google_cloud_to_local(self.py_file) hook = DataFlowHook(gcp_conn_id=self.gcp_conn_id, ...
def execute(self, context): """Execute the python dataflow job.""" bucket_helper = GoogleCloudBucketHelper( self.gcp_conn_id, self.delegate_to) self.py_file = bucket_helper.google_cloud_to_local(self.py_file) hook = DataFlowHook(gcp_conn_id=self.gcp_conn_id, ...
[ "Execute", "the", "python", "dataflow", "job", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/operators/dataflow_operator.py#L363-L380
[ "def", "execute", "(", "self", ",", "context", ")", ":", "bucket_helper", "=", "GoogleCloudBucketHelper", "(", "self", ".", "gcp_conn_id", ",", "self", ".", "delegate_to", ")", "self", ".", "py_file", "=", "bucket_helper", ".", "google_cloud_to_local", "(", "s...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
GoogleCloudBucketHelper.google_cloud_to_local
Checks whether the file specified by file_name is stored in Google Cloud Storage (GCS), if so, downloads the file and saves it locally. The full path of the saved file will be returned. Otherwise the local file_name will be returned immediately. :param file_name: The full path of input ...
airflow/contrib/operators/dataflow_operator.py
def google_cloud_to_local(self, file_name): """ Checks whether the file specified by file_name is stored in Google Cloud Storage (GCS), if so, downloads the file and saves it locally. The full path of the saved file will be returned. Otherwise the local file_name will be returned...
def google_cloud_to_local(self, file_name): """ Checks whether the file specified by file_name is stored in Google Cloud Storage (GCS), if so, downloads the file and saves it locally. The full path of the saved file will be returned. Otherwise the local file_name will be returned...
[ "Checks", "whether", "the", "file", "specified", "by", "file_name", "is", "stored", "in", "Google", "Cloud", "Storage", "(", "GCS", ")", "if", "so", "downloads", "the", "file", "and", "saves", "it", "locally", ".", "The", "full", "path", "of", "the", "sa...
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/operators/dataflow_operator.py#L392-L425
[ "def", "google_cloud_to_local", "(", "self", ",", "file_name", ")", ":", "if", "not", "file_name", ".", "startswith", "(", "'gs://'", ")", ":", "return", "file_name", "# Extracts bucket_id and object_id by first removing 'gs://' prefix and", "# then split the remaining by pat...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
run_migrations_offline
Run migrations in 'offline' mode. This configures the context with just a URL and not an Engine, though an Engine is acceptable here as well. By skipping the Engine creation we don't even need a DBAPI to be available. Calls to context.execute() here emit the given string to the script output.
airflow/migrations/env.py
def run_migrations_offline(): """Run migrations in 'offline' mode. This configures the context with just a URL and not an Engine, though an Engine is acceptable here as well. By skipping the Engine creation we don't even need a DBAPI to be available. Calls to context.execute() here emit the g...
def run_migrations_offline(): """Run migrations in 'offline' mode. This configures the context with just a URL and not an Engine, though an Engine is acceptable here as well. By skipping the Engine creation we don't even need a DBAPI to be available. Calls to context.execute() here emit the g...
[ "Run", "migrations", "in", "offline", "mode", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/migrations/env.py#L48-L65
[ "def", "run_migrations_offline", "(", ")", ":", "context", ".", "configure", "(", "url", "=", "settings", ".", "SQL_ALCHEMY_CONN", ",", "target_metadata", "=", "target_metadata", ",", "literal_binds", "=", "True", ",", "compare_type", "=", "COMPARE_TYPE", ")", "...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
run_migrations_online
Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context.
airflow/migrations/env.py
def run_migrations_online(): """Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context. """ connectable = settings.engine with connectable.connect() as connection: context.configure( connection=connection, ...
def run_migrations_online(): """Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context. """ connectable = settings.engine with connectable.connect() as connection: context.configure( connection=connection, ...
[ "Run", "migrations", "in", "online", "mode", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/migrations/env.py#L68-L86
[ "def", "run_migrations_online", "(", ")", ":", "connectable", "=", "settings", ".", "engine", "with", "connectable", ".", "connect", "(", ")", "as", "connection", ":", "context", ".", "configure", "(", "connection", "=", "connection", ",", "transaction_per_migra...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigtableHook.delete_instance
Deletes the specified Cloud Bigtable instance. Raises google.api_core.exceptions.NotFound if the Cloud Bigtable instance does not exist. :param project_id: Optional, Google Cloud Platform project ID where the BigTable exists. If set to None or missing, the default projec...
airflow/contrib/hooks/gcp_bigtable_hook.py
def delete_instance(self, instance_id, project_id=None): """ Deletes the specified Cloud Bigtable instance. Raises google.api_core.exceptions.NotFound if the Cloud Bigtable instance does not exist. :param project_id: Optional, Google Cloud Platform project ID where the ...
def delete_instance(self, instance_id, project_id=None): """ Deletes the specified Cloud Bigtable instance. Raises google.api_core.exceptions.NotFound if the Cloud Bigtable instance does not exist. :param project_id: Optional, Google Cloud Platform project ID where the ...
[ "Deletes", "the", "specified", "Cloud", "Bigtable", "instance", ".", "Raises", "google", ".", "api_core", ".", "exceptions", ".", "NotFound", "if", "the", "Cloud", "Bigtable", "instance", "does", "not", "exist", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_bigtable_hook.py#L69-L87
[ "def", "delete_instance", "(", "self", ",", "instance_id", ",", "project_id", "=", "None", ")", ":", "instance", "=", "self", ".", "get_instance", "(", "instance_id", "=", "instance_id", ",", "project_id", "=", "project_id", ")", "if", "instance", ":", "inst...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigtableHook.create_instance
Creates new instance. :type instance_id: str :param instance_id: The ID for the new instance. :type main_cluster_id: str :param main_cluster_id: The ID for main cluster for the new instance. :type main_cluster_zone: str :param main_cluster_zone: The zone for main cluster...
airflow/contrib/hooks/gcp_bigtable_hook.py
def create_instance(self, instance_id, main_cluster_id, main_cluster_zone, project_id=None, replica_cluster_id=None, replica_cluster_zone=None, instance...
def create_instance(self, instance_id, main_cluster_id, main_cluster_zone, project_id=None, replica_cluster_id=None, replica_cluster_zone=None, instance...
[ "Creates", "new", "instance", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_bigtable_hook.py#L90-L168
[ "def", "create_instance", "(", "self", ",", "instance_id", ",", "main_cluster_id", ",", "main_cluster_zone", ",", "project_id", "=", "None", ",", "replica_cluster_id", "=", "None", ",", "replica_cluster_zone", "=", "None", ",", "instance_display_name", "=", "None", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigtableHook.create_table
Creates the specified Cloud Bigtable table. Raises ``google.api_core.exceptions.AlreadyExists`` if the table exists. :type instance: Instance :param instance: The Cloud Bigtable instance that owns the table. :type table_id: str :param table_id: The ID of the table to create in C...
airflow/contrib/hooks/gcp_bigtable_hook.py
def create_table(instance, table_id, initial_split_keys=None, column_families=None): """ Creates the specified Cloud Bigtable table. Raises ``google.api_core.exceptions.AlreadyExists`` if the table exists. :type instance: In...
def create_table(instance, table_id, initial_split_keys=None, column_families=None): """ Creates the specified Cloud Bigtable table. Raises ``google.api_core.exceptions.AlreadyExists`` if the table exists. :type instance: In...
[ "Creates", "the", "specified", "Cloud", "Bigtable", "table", ".", "Raises", "google", ".", "api_core", ".", "exceptions", ".", "AlreadyExists", "if", "the", "table", "exists", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_bigtable_hook.py#L171-L196
[ "def", "create_table", "(", "instance", ",", "table_id", ",", "initial_split_keys", "=", "None", ",", "column_families", "=", "None", ")", ":", "if", "column_families", "is", "None", ":", "column_families", "=", "{", "}", "if", "initial_split_keys", "is", "Non...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigtableHook.delete_table
Deletes the specified table in Cloud Bigtable. Raises google.api_core.exceptions.NotFound if the table does not exist. :type instance_id: str :param instance_id: The ID of the Cloud Bigtable instance. :type table_id: str :param table_id: The ID of the table in Cloud Bigtable. ...
airflow/contrib/hooks/gcp_bigtable_hook.py
def delete_table(self, instance_id, table_id, project_id=None): """ Deletes the specified table in Cloud Bigtable. Raises google.api_core.exceptions.NotFound if the table does not exist. :type instance_id: str :param instance_id: The ID of the Cloud Bigtable instance. :t...
def delete_table(self, instance_id, table_id, project_id=None): """ Deletes the specified table in Cloud Bigtable. Raises google.api_core.exceptions.NotFound if the table does not exist. :type instance_id: str :param instance_id: The ID of the Cloud Bigtable instance. :t...
[ "Deletes", "the", "specified", "table", "in", "Cloud", "Bigtable", ".", "Raises", "google", ".", "api_core", ".", "exceptions", ".", "NotFound", "if", "the", "table", "does", "not", "exist", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_bigtable_hook.py#L199-L214
[ "def", "delete_table", "(", "self", ",", "instance_id", ",", "table_id", ",", "project_id", "=", "None", ")", ":", "table", "=", "self", ".", "get_instance", "(", "instance_id", "=", "instance_id", ",", "project_id", "=", "project_id", ")", ".", "table", "...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigtableHook.update_cluster
Updates number of nodes in the specified Cloud Bigtable cluster. Raises google.api_core.exceptions.NotFound if the cluster does not exist. :type instance: Instance :param instance: The Cloud Bigtable instance that owns the cluster. :type cluster_id: str :param cluster_id: The ID...
airflow/contrib/hooks/gcp_bigtable_hook.py
def update_cluster(instance, cluster_id, nodes): """ Updates number of nodes in the specified Cloud Bigtable cluster. Raises google.api_core.exceptions.NotFound if the cluster does not exist. :type instance: Instance :param instance: The Cloud Bigtable instance that owns the clu...
def update_cluster(instance, cluster_id, nodes): """ Updates number of nodes in the specified Cloud Bigtable cluster. Raises google.api_core.exceptions.NotFound if the cluster does not exist. :type instance: Instance :param instance: The Cloud Bigtable instance that owns the clu...
[ "Updates", "number", "of", "nodes", "in", "the", "specified", "Cloud", "Bigtable", "cluster", ".", "Raises", "google", ".", "api_core", ".", "exceptions", ".", "NotFound", "if", "the", "cluster", "does", "not", "exist", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_bigtable_hook.py#L217-L231
[ "def", "update_cluster", "(", "instance", ",", "cluster_id", ",", "nodes", ")", ":", "cluster", "=", "Cluster", "(", "cluster_id", ",", "instance", ")", "cluster", ".", "serve_nodes", "=", "nodes", "cluster", ".", "update", "(", ")" ]
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
HiveCliHook._prepare_cli_cmd
This function creates the command list from available information
airflow/hooks/hive_hooks.py
def _prepare_cli_cmd(self): """ This function creates the command list from available information """ conn = self.conn hive_bin = 'hive' cmd_extra = [] if self.use_beeline: hive_bin = 'beeline' jdbc_url = "jdbc:hive2://{host}:{port}/{schem...
def _prepare_cli_cmd(self): """ This function creates the command list from available information """ conn = self.conn hive_bin = 'hive' cmd_extra = [] if self.use_beeline: hive_bin = 'beeline' jdbc_url = "jdbc:hive2://{host}:{port}/{schem...
[ "This", "function", "creates", "the", "command", "list", "from", "available", "information" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L106-L146
[ "def", "_prepare_cli_cmd", "(", "self", ")", ":", "conn", "=", "self", ".", "conn", "hive_bin", "=", "'hive'", "cmd_extra", "=", "[", "]", "if", "self", ".", "use_beeline", ":", "hive_bin", "=", "'beeline'", "jdbc_url", "=", "\"jdbc:hive2://{host}:{port}/{sche...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
HiveCliHook._prepare_hiveconf
This function prepares a list of hiveconf params from a dictionary of key value pairs. :param d: :type d: dict >>> hh = HiveCliHook() >>> hive_conf = {"hive.exec.dynamic.partition": "true", ... "hive.exec.dynamic.partition.mode": "nonstrict"} >>> hh._prepare_hiv...
airflow/hooks/hive_hooks.py
def _prepare_hiveconf(d): """ This function prepares a list of hiveconf params from a dictionary of key value pairs. :param d: :type d: dict >>> hh = HiveCliHook() >>> hive_conf = {"hive.exec.dynamic.partition": "true", ... "hive.exec.dynamic.partition.m...
def _prepare_hiveconf(d): """ This function prepares a list of hiveconf params from a dictionary of key value pairs. :param d: :type d: dict >>> hh = HiveCliHook() >>> hive_conf = {"hive.exec.dynamic.partition": "true", ... "hive.exec.dynamic.partition.m...
[ "This", "function", "prepares", "a", "list", "of", "hiveconf", "params", "from", "a", "dictionary", "of", "key", "value", "pairs", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L149-L169
[ "def", "_prepare_hiveconf", "(", "d", ")", ":", "if", "not", "d", ":", "return", "[", "]", "return", "as_flattened_list", "(", "zip", "(", "[", "\"-hiveconf\"", "]", "*", "len", "(", "d", ")", ",", "[", "\"{}={}\"", ".", "format", "(", "k", ",", "v...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
HiveCliHook.run_cli
Run an hql statement using the hive cli. If hive_conf is specified it should be a dict and the entries will be set as key/value pairs in HiveConf :param hive_conf: if specified these key value pairs will be passed to hive as ``-hiveconf "key"="value"``. Note that they will be ...
airflow/hooks/hive_hooks.py
def run_cli(self, hql, schema=None, verbose=True, hive_conf=None): """ Run an hql statement using the hive cli. If hive_conf is specified it should be a dict and the entries will be set as key/value pairs in HiveConf :param hive_conf: if specified these key value pairs will be ...
def run_cli(self, hql, schema=None, verbose=True, hive_conf=None): """ Run an hql statement using the hive cli. If hive_conf is specified it should be a dict and the entries will be set as key/value pairs in HiveConf :param hive_conf: if specified these key value pairs will be ...
[ "Run", "an", "hql", "statement", "using", "the", "hive", "cli", ".", "If", "hive_conf", "is", "specified", "it", "should", "be", "a", "dict", "and", "the", "entries", "will", "be", "set", "as", "key", "/", "value", "pairs", "in", "HiveConf" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L171-L255
[ "def", "run_cli", "(", "self", ",", "hql", ",", "schema", "=", "None", ",", "verbose", "=", "True", ",", "hive_conf", "=", "None", ")", ":", "conn", "=", "self", ".", "conn", "schema", "=", "schema", "or", "conn", ".", "schema", "if", "schema", ":"...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
HiveCliHook.load_df
Loads a pandas DataFrame into hive. Hive data types will be inferred if not passed but column names will not be sanitized. :param df: DataFrame to load into a Hive table :type df: pandas.DataFrame :param table: target Hive table, use dot notation to target a specifi...
airflow/hooks/hive_hooks.py
def load_df( self, df, table, field_dict=None, delimiter=',', encoding='utf8', pandas_kwargs=None, **kwargs): """ Loads a pandas DataFrame into hive. Hive data types will be inferred if not passed but column nam...
def load_df( self, df, table, field_dict=None, delimiter=',', encoding='utf8', pandas_kwargs=None, **kwargs): """ Loads a pandas DataFrame into hive. Hive data types will be inferred if not passed but column nam...
[ "Loads", "a", "pandas", "DataFrame", "into", "hive", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L300-L372
[ "def", "load_df", "(", "self", ",", "df", ",", "table", ",", "field_dict", "=", "None", ",", "delimiter", "=", "','", ",", "encoding", "=", "'utf8'", ",", "pandas_kwargs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "def", "_infer_field_types_from_df...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
HiveCliHook.load_file
Loads a local file into Hive Note that the table generated in Hive uses ``STORED AS textfile`` which isn't the most efficient serialization format. If a large amount of data is loaded and/or if the tables gets queried considerably, you may want to use this operator only to stage...
airflow/hooks/hive_hooks.py
def load_file( self, filepath, table, delimiter=",", field_dict=None, create=True, overwrite=True, partition=None, recreate=False, tblproperties=None): """ Loads a local file into Hive...
def load_file( self, filepath, table, delimiter=",", field_dict=None, create=True, overwrite=True, partition=None, recreate=False, tblproperties=None): """ Loads a local file into Hive...
[ "Loads", "a", "local", "file", "into", "Hive" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L374-L457
[ "def", "load_file", "(", "self", ",", "filepath", ",", "table", ",", "delimiter", "=", "\",\"", ",", "field_dict", "=", "None", ",", "create", "=", "True", ",", "overwrite", "=", "True", ",", "partition", "=", "None", ",", "recreate", "=", "False", ","...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
HiveMetastoreHook.get_metastore_client
Returns a Hive thrift client.
airflow/hooks/hive_hooks.py
def get_metastore_client(self): """ Returns a Hive thrift client. """ import hmsclient from thrift.transport import TSocket, TTransport from thrift.protocol import TBinaryProtocol ms = self.metastore_conn auth_mechanism = ms.extra_dejson.get('authMechanism...
def get_metastore_client(self): """ Returns a Hive thrift client. """ import hmsclient from thrift.transport import TSocket, TTransport from thrift.protocol import TBinaryProtocol ms = self.metastore_conn auth_mechanism = ms.extra_dejson.get('authMechanism...
[ "Returns", "a", "Hive", "thrift", "client", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L489-L524
[ "def", "get_metastore_client", "(", "self", ")", ":", "import", "hmsclient", "from", "thrift", ".", "transport", "import", "TSocket", ",", "TTransport", "from", "thrift", ".", "protocol", "import", "TBinaryProtocol", "ms", "=", "self", ".", "metastore_conn", "au...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
HiveMetastoreHook.check_for_partition
Checks whether a partition exists :param schema: Name of hive schema (database) @table belongs to :type schema: str :param table: Name of hive table @partition belongs to :type schema: str :partition: Expression that matches the partitions to check for (eg `a = 'b' A...
airflow/hooks/hive_hooks.py
def check_for_partition(self, schema, table, partition): """ Checks whether a partition exists :param schema: Name of hive schema (database) @table belongs to :type schema: str :param table: Name of hive table @partition belongs to :type schema: str :partition: E...
def check_for_partition(self, schema, table, partition): """ Checks whether a partition exists :param schema: Name of hive schema (database) @table belongs to :type schema: str :param table: Name of hive table @partition belongs to :type schema: str :partition: E...
[ "Checks", "whether", "a", "partition", "exists" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L529-L554
[ "def", "check_for_partition", "(", "self", ",", "schema", ",", "table", ",", "partition", ")", ":", "with", "self", ".", "metastore", "as", "client", ":", "partitions", "=", "client", ".", "get_partitions_by_filter", "(", "schema", ",", "table", ",", "partit...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
HiveMetastoreHook.check_for_named_partition
Checks whether a partition with a given name exists :param schema: Name of hive schema (database) @table belongs to :type schema: str :param table: Name of hive table @partition belongs to :type schema: str :partition: Name of the partitions to check for (eg `a=b/c=d`) :...
airflow/hooks/hive_hooks.py
def check_for_named_partition(self, schema, table, partition_name): """ Checks whether a partition with a given name exists :param schema: Name of hive schema (database) @table belongs to :type schema: str :param table: Name of hive table @partition belongs to :type sche...
def check_for_named_partition(self, schema, table, partition_name): """ Checks whether a partition with a given name exists :param schema: Name of hive schema (database) @table belongs to :type schema: str :param table: Name of hive table @partition belongs to :type sche...
[ "Checks", "whether", "a", "partition", "with", "a", "given", "name", "exists" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L556-L576
[ "def", "check_for_named_partition", "(", "self", ",", "schema", ",", "table", ",", "partition_name", ")", ":", "with", "self", ".", "metastore", "as", "client", ":", "return", "client", ".", "check_for_named_partition", "(", "schema", ",", "table", ",", "parti...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
HiveMetastoreHook.get_table
Get a metastore table object >>> hh = HiveMetastoreHook() >>> t = hh.get_table(db='airflow', table_name='static_babynames') >>> t.tableName 'static_babynames' >>> [col.name for col in t.sd.cols] ['state', 'year', 'name', 'gender', 'num']
airflow/hooks/hive_hooks.py
def get_table(self, table_name, db='default'): """Get a metastore table object >>> hh = HiveMetastoreHook() >>> t = hh.get_table(db='airflow', table_name='static_babynames') >>> t.tableName 'static_babynames' >>> [col.name for col in t.sd.cols] ['state', 'year', ...
def get_table(self, table_name, db='default'): """Get a metastore table object >>> hh = HiveMetastoreHook() >>> t = hh.get_table(db='airflow', table_name='static_babynames') >>> t.tableName 'static_babynames' >>> [col.name for col in t.sd.cols] ['state', 'year', ...
[ "Get", "a", "metastore", "table", "object" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L578-L591
[ "def", "get_table", "(", "self", ",", "table_name", ",", "db", "=", "'default'", ")", ":", "if", "db", "==", "'default'", "and", "'.'", "in", "table_name", ":", "db", ",", "table_name", "=", "table_name", ".", "split", "(", "'.'", ")", "[", ":", "2",...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
HiveMetastoreHook.get_tables
Get a metastore table object
airflow/hooks/hive_hooks.py
def get_tables(self, db, pattern='*'): """ Get a metastore table object """ with self.metastore as client: tables = client.get_tables(db_name=db, pattern=pattern) return client.get_table_objects_by_name(db, tables)
def get_tables(self, db, pattern='*'): """ Get a metastore table object """ with self.metastore as client: tables = client.get_tables(db_name=db, pattern=pattern) return client.get_table_objects_by_name(db, tables)
[ "Get", "a", "metastore", "table", "object" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L593-L599
[ "def", "get_tables", "(", "self", ",", "db", ",", "pattern", "=", "'*'", ")", ":", "with", "self", ".", "metastore", "as", "client", ":", "tables", "=", "client", ".", "get_tables", "(", "db_name", "=", "db", ",", "pattern", "=", "pattern", ")", "ret...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
HiveMetastoreHook.get_partitions
Returns a list of all partitions in a table. Works only for tables with less than 32767 (java short max val). For subpartitioned table, the number might easily exceed this. >>> hh = HiveMetastoreHook() >>> t = 'static_babynames_partitioned' >>> parts = hh.get_partitions(schema='...
airflow/hooks/hive_hooks.py
def get_partitions( self, schema, table_name, filter=None): """ Returns a list of all partitions in a table. Works only for tables with less than 32767 (java short max val). For subpartitioned table, the number might easily exceed this. >>> hh = HiveMetastoreHook() ...
def get_partitions( self, schema, table_name, filter=None): """ Returns a list of all partitions in a table. Works only for tables with less than 32767 (java short max val). For subpartitioned table, the number might easily exceed this. >>> hh = HiveMetastoreHook() ...
[ "Returns", "a", "list", "of", "all", "partitions", "in", "a", "table", ".", "Works", "only", "for", "tables", "with", "less", "than", "32767", "(", "java", "short", "max", "val", ")", ".", "For", "subpartitioned", "table", "the", "number", "might", "easi...
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L608-L638
[ "def", "get_partitions", "(", "self", ",", "schema", ",", "table_name", ",", "filter", "=", "None", ")", ":", "with", "self", ".", "metastore", "as", "client", ":", "table", "=", "client", ".", "get_table", "(", "dbname", "=", "schema", ",", "tbl_name", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
HiveMetastoreHook._get_max_partition_from_part_specs
Helper method to get max partition of partitions with partition_key from part specs. key:value pair in filter_map will be used to filter out partitions. :param part_specs: list of partition specs. :type part_specs: list :param partition_key: partition key name. :type par...
airflow/hooks/hive_hooks.py
def _get_max_partition_from_part_specs(part_specs, partition_key, filter_map): """ Helper method to get max partition of partitions with partition_key from part specs. key:value pair in filter_map will be used to filter out partitions. :param part_specs: list of partition specs....
def _get_max_partition_from_part_specs(part_specs, partition_key, filter_map): """ Helper method to get max partition of partitions with partition_key from part specs. key:value pair in filter_map will be used to filter out partitions. :param part_specs: list of partition specs....
[ "Helper", "method", "to", "get", "max", "partition", "of", "partitions", "with", "partition_key", "from", "part", "specs", ".", "key", ":", "value", "pair", "in", "filter_map", "will", "be", "used", "to", "filter", "out", "partitions", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L641-L680
[ "def", "_get_max_partition_from_part_specs", "(", "part_specs", ",", "partition_key", ",", "filter_map", ")", ":", "if", "not", "part_specs", ":", "return", "None", "# Assuming all specs have the same keys.", "if", "partition_key", "not", "in", "part_specs", "[", "0", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
HiveMetastoreHook.max_partition
Returns the maximum value for all partitions with given field in a table. If only one partition key exist in the table, the key will be used as field. filter_map should be a partition_key:partition_value map and will be used to filter out partitions. :param schema: schema name. ...
airflow/hooks/hive_hooks.py
def max_partition(self, schema, table_name, field=None, filter_map=None): """ Returns the maximum value for all partitions with given field in a table. If only one partition key exist in the table, the key will be used as field. filter_map should be a partition_key:partition_value map an...
def max_partition(self, schema, table_name, field=None, filter_map=None): """ Returns the maximum value for all partitions with given field in a table. If only one partition key exist in the table, the key will be used as field. filter_map should be a partition_key:partition_value map an...
[ "Returns", "the", "maximum", "value", "for", "all", "partitions", "with", "given", "field", "in", "a", "table", ".", "If", "only", "one", "partition", "key", "exist", "in", "the", "table", "the", "key", "will", "be", "used", "as", "field", ".", "filter_m...
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L682-L729
[ "def", "max_partition", "(", "self", ",", "schema", ",", "table_name", ",", "field", "=", "None", ",", "filter_map", "=", "None", ")", ":", "with", "self", ".", "metastore", "as", "client", ":", "table", "=", "client", ".", "get_table", "(", "dbname", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
HiveMetastoreHook.table_exists
Check if table exists >>> hh = HiveMetastoreHook() >>> hh.table_exists(db='airflow', table_name='static_babynames') True >>> hh.table_exists(db='airflow', table_name='does_not_exist') False
airflow/hooks/hive_hooks.py
def table_exists(self, table_name, db='default'): """ Check if table exists >>> hh = HiveMetastoreHook() >>> hh.table_exists(db='airflow', table_name='static_babynames') True >>> hh.table_exists(db='airflow', table_name='does_not_exist') False """ ...
def table_exists(self, table_name, db='default'): """ Check if table exists >>> hh = HiveMetastoreHook() >>> hh.table_exists(db='airflow', table_name='static_babynames') True >>> hh.table_exists(db='airflow', table_name='does_not_exist') False """ ...
[ "Check", "if", "table", "exists" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L731-L745
[ "def", "table_exists", "(", "self", ",", "table_name", ",", "db", "=", "'default'", ")", ":", "try", ":", "self", ".", "get_table", "(", "table_name", ",", "db", ")", "return", "True", "except", "Exception", ":", "return", "False" ]
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
HiveServer2Hook.get_conn
Returns a Hive connection object.
airflow/hooks/hive_hooks.py
def get_conn(self, schema=None): """ Returns a Hive connection object. """ db = self.get_connection(self.hiveserver2_conn_id) auth_mechanism = db.extra_dejson.get('authMechanism', 'NONE') if auth_mechanism == 'NONE' and db.login is None: # we need to give a us...
def get_conn(self, schema=None): """ Returns a Hive connection object. """ db = self.get_connection(self.hiveserver2_conn_id) auth_mechanism = db.extra_dejson.get('authMechanism', 'NONE') if auth_mechanism == 'NONE' and db.login is None: # we need to give a us...
[ "Returns", "a", "Hive", "connection", "object", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L758-L789
[ "def", "get_conn", "(", "self", ",", "schema", "=", "None", ")", ":", "db", "=", "self", ".", "get_connection", "(", "self", ".", "hiveserver2_conn_id", ")", "auth_mechanism", "=", "db", ".", "extra_dejson", ".", "get", "(", "'authMechanism'", ",", "'NONE'...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
HiveServer2Hook.get_results
Get results of the provided hql in target schema. :param hql: hql to be executed. :type hql: str or list :param schema: target schema, default to 'default'. :type schema: str :param fetch_size: max size of result to fetch. :type fetch_size: int :param hive_conf: ...
airflow/hooks/hive_hooks.py
def get_results(self, hql, schema='default', fetch_size=None, hive_conf=None): """ Get results of the provided hql in target schema. :param hql: hql to be executed. :type hql: str or list :param schema: target schema, default to 'default'. :type schema: str :para...
def get_results(self, hql, schema='default', fetch_size=None, hive_conf=None): """ Get results of the provided hql in target schema. :param hql: hql to be executed. :type hql: str or list :param schema: target schema, default to 'default'. :type schema: str :para...
[ "Get", "results", "of", "the", "provided", "hql", "in", "target", "schema", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L834-L856
[ "def", "get_results", "(", "self", ",", "hql", ",", "schema", "=", "'default'", ",", "fetch_size", "=", "None", ",", "hive_conf", "=", "None", ")", ":", "results_iter", "=", "self", ".", "_get_results", "(", "hql", ",", "schema", ",", "fetch_size", "=", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
HiveServer2Hook.to_csv
Execute hql in target schema and write results to a csv file. :param hql: hql to be executed. :type hql: str or list :param csv_filepath: filepath of csv to write results into. :type csv_filepath: str :param schema: target schema, default to 'default'. :type schema: str ...
airflow/hooks/hive_hooks.py
def to_csv( self, hql, csv_filepath, schema='default', delimiter=',', lineterminator='\r\n', output_header=True, fetch_size=1000, hive_conf=None): """ Execute hql in target schema and write result...
def to_csv( self, hql, csv_filepath, schema='default', delimiter=',', lineterminator='\r\n', output_header=True, fetch_size=1000, hive_conf=None): """ Execute hql in target schema and write result...
[ "Execute", "hql", "in", "target", "schema", "and", "write", "results", "to", "a", "csv", "file", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L858-L918
[ "def", "to_csv", "(", "self", ",", "hql", ",", "csv_filepath", ",", "schema", "=", "'default'", ",", "delimiter", "=", "','", ",", "lineterminator", "=", "'\\r\\n'", ",", "output_header", "=", "True", ",", "fetch_size", "=", "1000", ",", "hive_conf", "=", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
HiveServer2Hook.get_records
Get a set of records from a Hive query. :param hql: hql to be executed. :type hql: str or list :param schema: target schema, default to 'default'. :type schema: str :param hive_conf: hive_conf to execute alone with the hql. :type hive_conf: dict :return: result o...
airflow/hooks/hive_hooks.py
def get_records(self, hql, schema='default', hive_conf=None): """ Get a set of records from a Hive query. :param hql: hql to be executed. :type hql: str or list :param schema: target schema, default to 'default'. :type schema: str :param hive_conf: hive_conf to e...
def get_records(self, hql, schema='default', hive_conf=None): """ Get a set of records from a Hive query. :param hql: hql to be executed. :type hql: str or list :param schema: target schema, default to 'default'. :type schema: str :param hive_conf: hive_conf to e...
[ "Get", "a", "set", "of", "records", "from", "a", "Hive", "query", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L920-L938
[ "def", "get_records", "(", "self", ",", "hql", ",", "schema", "=", "'default'", ",", "hive_conf", "=", "None", ")", ":", "return", "self", ".", "get_results", "(", "hql", ",", "schema", "=", "schema", ",", "hive_conf", "=", "hive_conf", ")", "[", "'dat...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
HiveServer2Hook.get_pandas_df
Get a pandas dataframe from a Hive query :param hql: hql to be executed. :type hql: str or list :param schema: target schema, default to 'default'. :type schema: str :return: result of hql execution :rtype: DataFrame >>> hh = HiveServer2Hook() >>> sql = ...
airflow/hooks/hive_hooks.py
def get_pandas_df(self, hql, schema='default'): """ Get a pandas dataframe from a Hive query :param hql: hql to be executed. :type hql: str or list :param schema: target schema, default to 'default'. :type schema: str :return: result of hql execution :rty...
def get_pandas_df(self, hql, schema='default'): """ Get a pandas dataframe from a Hive query :param hql: hql to be executed. :type hql: str or list :param schema: target schema, default to 'default'. :type schema: str :return: result of hql execution :rty...
[ "Get", "a", "pandas", "dataframe", "from", "a", "Hive", "query" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/hooks/hive_hooks.py#L940-L963
[ "def", "get_pandas_df", "(", "self", ",", "hql", ",", "schema", "=", "'default'", ")", ":", "import", "pandas", "as", "pd", "res", "=", "self", ".", "get_results", "(", "hql", ",", "schema", "=", "schema", ")", "df", "=", "pd", ".", "DataFrame", "(",...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
CloudVisionHook.get_conn
Retrieves connection to Cloud Vision. :return: Google Cloud Vision client object. :rtype: google.cloud.vision_v1.ProductSearchClient
airflow/contrib/hooks/gcp_vision_hook.py
def get_conn(self): """ Retrieves connection to Cloud Vision. :return: Google Cloud Vision client object. :rtype: google.cloud.vision_v1.ProductSearchClient """ if not self._client: self._client = ProductSearchClient(credentials=self._get_credentials()) ...
def get_conn(self): """ Retrieves connection to Cloud Vision. :return: Google Cloud Vision client object. :rtype: google.cloud.vision_v1.ProductSearchClient """ if not self._client: self._client = ProductSearchClient(credentials=self._get_credentials()) ...
[ "Retrieves", "connection", "to", "Cloud", "Vision", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_vision_hook.py#L106-L115
[ "def", "get_conn", "(", "self", ")", ":", "if", "not", "self", ".", "_client", ":", "self", ".", "_client", "=", "ProductSearchClient", "(", "credentials", "=", "self", ".", "_get_credentials", "(", ")", ")", "return", "self", ".", "_client" ]
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
CloudVisionHook.create_product_set
For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductSetCreateOperator`
airflow/contrib/hooks/gcp_vision_hook.py
def create_product_set( self, location, product_set, project_id=None, product_set_id=None, retry=None, timeout=None, metadata=None, ): """ For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVi...
def create_product_set( self, location, product_set, project_id=None, product_set_id=None, retry=None, timeout=None, metadata=None, ): """ For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVi...
[ "For", "the", "documentation", "see", ":", ":", "class", ":", "~airflow", ".", "contrib", ".", "operators", ".", "gcp_vision_operator", ".", "CloudVisionProductSetCreateOperator" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_vision_hook.py#L128-L161
[ "def", "create_product_set", "(", "self", ",", "location", ",", "product_set", ",", "project_id", "=", "None", ",", "product_set_id", "=", "None", ",", "retry", "=", "None", ",", "timeout", "=", "None", ",", "metadata", "=", "None", ",", ")", ":", "clien...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
CloudVisionHook.get_product_set
For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductSetGetOperator`
airflow/contrib/hooks/gcp_vision_hook.py
def get_product_set( self, location, product_set_id, project_id=None, retry=None, timeout=None, metadata=None ): """ For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductSetGetOperator` """ client = self.get_conn() ...
def get_product_set( self, location, product_set_id, project_id=None, retry=None, timeout=None, metadata=None ): """ For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductSetGetOperator` """ client = self.get_conn() ...
[ "For", "the", "documentation", "see", ":", ":", "class", ":", "~airflow", ".", "contrib", ".", "operators", ".", "gcp_vision_operator", ".", "CloudVisionProductSetGetOperator" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_vision_hook.py#L165-L178
[ "def", "get_product_set", "(", "self", ",", "location", ",", "product_set_id", ",", "project_id", "=", "None", ",", "retry", "=", "None", ",", "timeout", "=", "None", ",", "metadata", "=", "None", ")", ":", "client", "=", "self", ".", "get_conn", "(", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
CloudVisionHook.update_product_set
For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductSetUpdateOperator`
airflow/contrib/hooks/gcp_vision_hook.py
def update_product_set( self, product_set, location=None, product_set_id=None, update_mask=None, project_id=None, retry=None, timeout=None, metadata=None, ): """ For the documentation see: :class:`~airflow.contrib.operat...
def update_product_set( self, product_set, location=None, product_set_id=None, update_mask=None, project_id=None, retry=None, timeout=None, metadata=None, ): """ For the documentation see: :class:`~airflow.contrib.operat...
[ "For", "the", "documentation", "see", ":", ":", "class", ":", "~airflow", ".", "contrib", ".", "operators", ".", "gcp_vision_operator", ".", "CloudVisionProductSetUpdateOperator" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_vision_hook.py#L182-L207
[ "def", "update_product_set", "(", "self", ",", "product_set", ",", "location", "=", "None", ",", "product_set_id", "=", "None", ",", "update_mask", "=", "None", ",", "project_id", "=", "None", ",", "retry", "=", "None", ",", "timeout", "=", "None", ",", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
CloudVisionHook.delete_product_set
For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductSetDeleteOperator`
airflow/contrib/hooks/gcp_vision_hook.py
def delete_product_set( self, location, product_set_id, project_id=None, retry=None, timeout=None, metadata=None ): """ For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductSetDeleteOperator` """ client = self.get_conn() ...
def delete_product_set( self, location, product_set_id, project_id=None, retry=None, timeout=None, metadata=None ): """ For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductSetDeleteOperator` """ client = self.get_conn() ...
[ "For", "the", "documentation", "see", ":", ":", "class", ":", "~airflow", ".", "contrib", ".", "operators", ".", "gcp_vision_operator", ".", "CloudVisionProductSetDeleteOperator" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_vision_hook.py#L211-L222
[ "def", "delete_product_set", "(", "self", ",", "location", ",", "product_set_id", ",", "project_id", "=", "None", ",", "retry", "=", "None", ",", "timeout", "=", "None", ",", "metadata", "=", "None", ")", ":", "client", "=", "self", ".", "get_conn", "(",...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
CloudVisionHook.create_product
For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductCreateOperator`
airflow/contrib/hooks/gcp_vision_hook.py
def create_product( self, location, product, project_id=None, product_id=None, retry=None, timeout=None, metadata=None ): """ For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductCreateOperator` """ client = self.get_conn...
def create_product( self, location, product, project_id=None, product_id=None, retry=None, timeout=None, metadata=None ): """ For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductCreateOperator` """ client = self.get_conn...
[ "For", "the", "documentation", "see", ":", ":", "class", ":", "~airflow", ".", "contrib", ".", "operators", ".", "gcp_vision_operator", ".", "CloudVisionProductCreateOperator" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_vision_hook.py#L226-L252
[ "def", "create_product", "(", "self", ",", "location", ",", "product", ",", "project_id", "=", "None", ",", "product_id", "=", "None", ",", "retry", "=", "None", ",", "timeout", "=", "None", ",", "metadata", "=", "None", ")", ":", "client", "=", "self"...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
CloudVisionHook.get_product
For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductGetOperator`
airflow/contrib/hooks/gcp_vision_hook.py
def get_product(self, location, product_id, project_id=None, retry=None, timeout=None, metadata=None): """ For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductGetOperator` """ client = self.get_conn() name = ProductSearchCli...
def get_product(self, location, product_id, project_id=None, retry=None, timeout=None, metadata=None): """ For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductGetOperator` """ client = self.get_conn() name = ProductSearchCli...
[ "For", "the", "documentation", "see", ":", ":", "class", ":", "~airflow", ".", "contrib", ".", "operators", ".", "gcp_vision_operator", ".", "CloudVisionProductGetOperator" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_vision_hook.py#L256-L267
[ "def", "get_product", "(", "self", ",", "location", ",", "product_id", ",", "project_id", "=", "None", ",", "retry", "=", "None", ",", "timeout", "=", "None", ",", "metadata", "=", "None", ")", ":", "client", "=", "self", ".", "get_conn", "(", ")", "...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
CloudVisionHook.update_product
For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductUpdateOperator`
airflow/contrib/hooks/gcp_vision_hook.py
def update_product( self, product, location=None, product_id=None, update_mask=None, project_id=None, retry=None, timeout=None, metadata=None, ): """ For the documentation see: :class:`~airflow.contrib.operators.gcp_visi...
def update_product( self, product, location=None, product_id=None, update_mask=None, project_id=None, retry=None, timeout=None, metadata=None, ): """ For the documentation see: :class:`~airflow.contrib.operators.gcp_visi...
[ "For", "the", "documentation", "see", ":", ":", "class", ":", "~airflow", ".", "contrib", ".", "operators", ".", "gcp_vision_operator", ".", "CloudVisionProductUpdateOperator" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_vision_hook.py#L271-L294
[ "def", "update_product", "(", "self", ",", "product", ",", "location", "=", "None", ",", "product_id", "=", "None", ",", "update_mask", "=", "None", ",", "project_id", "=", "None", ",", "retry", "=", "None", ",", "timeout", "=", "None", ",", "metadata", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
CloudVisionHook.delete_product
For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductDeleteOperator`
airflow/contrib/hooks/gcp_vision_hook.py
def delete_product(self, location, product_id, project_id=None, retry=None, timeout=None, metadata=None): """ For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductDeleteOperator` """ client = self.get_conn() name = ProductSea...
def delete_product(self, location, product_id, project_id=None, retry=None, timeout=None, metadata=None): """ For the documentation see: :class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionProductDeleteOperator` """ client = self.get_conn() name = ProductSea...
[ "For", "the", "documentation", "see", ":", ":", "class", ":", "~airflow", ".", "contrib", ".", "operators", ".", "gcp_vision_operator", ".", "CloudVisionProductDeleteOperator" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_vision_hook.py#L298-L307
[ "def", "delete_product", "(", "self", ",", "location", ",", "product_id", ",", "project_id", "=", "None", ",", "retry", "=", "None", ",", "timeout", "=", "None", ",", "metadata", "=", "None", ")", ":", "client", "=", "self", ".", "get_conn", "(", ")", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
CloudVisionHook.create_reference_image
For the documentation see: :py:class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionReferenceImageCreateOperator`
airflow/contrib/hooks/gcp_vision_hook.py
def create_reference_image( self, location, product_id, reference_image, reference_image_id=None, project_id=None, retry=None, timeout=None, metadata=None, ): """ For the documentation see: :py:class:`~airflow.contrib.op...
def create_reference_image( self, location, product_id, reference_image, reference_image_id=None, project_id=None, retry=None, timeout=None, metadata=None, ): """ For the documentation see: :py:class:`~airflow.contrib.op...
[ "For", "the", "documentation", "see", ":", ":", "py", ":", "class", ":", "~airflow", ".", "contrib", ".", "operators", ".", "gcp_vision_operator", ".", "CloudVisionReferenceImageCreateOperator" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_vision_hook.py#L311-L349
[ "def", "create_reference_image", "(", "self", ",", "location", ",", "product_id", ",", "reference_image", ",", "reference_image_id", "=", "None", ",", "project_id", "=", "None", ",", "retry", "=", "None", ",", "timeout", "=", "None", ",", "metadata", "=", "N...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
CloudVisionHook.delete_reference_image
For the documentation see: :py:class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionReferenceImageCreateOperator`
airflow/contrib/hooks/gcp_vision_hook.py
def delete_reference_image( self, location, product_id, reference_image_id, project_id=None, retry=None, timeout=None, metadata=None, ): """ For the documentation see: :py:class:`~airflow.contrib.operators.gcp_vision_operator.Cl...
def delete_reference_image( self, location, product_id, reference_image_id, project_id=None, retry=None, timeout=None, metadata=None, ): """ For the documentation see: :py:class:`~airflow.contrib.operators.gcp_vision_operator.Cl...
[ "For", "the", "documentation", "see", ":", ":", "py", ":", "class", ":", "~airflow", ".", "contrib", ".", "operators", ".", "gcp_vision_operator", ".", "CloudVisionReferenceImageCreateOperator" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_vision_hook.py#L353-L375
[ "def", "delete_reference_image", "(", "self", ",", "location", ",", "product_id", ",", "reference_image_id", ",", "project_id", "=", "None", ",", "retry", "=", "None", ",", "timeout", "=", "None", ",", "metadata", "=", "None", ",", ")", ":", "client", "=",...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
CloudVisionHook.add_product_to_product_set
For the documentation see: :py:class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionAddProductToProductSetOperator`
airflow/contrib/hooks/gcp_vision_hook.py
def add_product_to_product_set( self, product_set_id, product_id, location=None, project_id=None, retry=None, timeout=None, metadata=None, ): """ For the documentation see: :py:class:`~airflow.contrib.operators.gcp_vision_operat...
def add_product_to_product_set( self, product_set_id, product_id, location=None, project_id=None, retry=None, timeout=None, metadata=None, ): """ For the documentation see: :py:class:`~airflow.contrib.operators.gcp_vision_operat...
[ "For", "the", "documentation", "see", ":", ":", "py", ":", "class", ":", "~airflow", ".", "contrib", ".", "operators", ".", "gcp_vision_operator", ".", "CloudVisionAddProductToProductSetOperator" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_vision_hook.py#L379-L404
[ "def", "add_product_to_product_set", "(", "self", ",", "product_set_id", ",", "product_id", ",", "location", "=", "None", ",", "project_id", "=", "None", ",", "retry", "=", "None", ",", "timeout", "=", "None", ",", "metadata", "=", "None", ",", ")", ":", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
CloudVisionHook.annotate_image
For the documentation see: :py:class:`~airflow.contrib.operators.gcp_vision_image_annotator_operator.CloudVisionAnnotateImage`
airflow/contrib/hooks/gcp_vision_hook.py
def annotate_image(self, request, retry=None, timeout=None): """ For the documentation see: :py:class:`~airflow.contrib.operators.gcp_vision_image_annotator_operator.CloudVisionAnnotateImage` """ client = self.annotator_client self.log.info('Annotating image') r...
def annotate_image(self, request, retry=None, timeout=None): """ For the documentation see: :py:class:`~airflow.contrib.operators.gcp_vision_image_annotator_operator.CloudVisionAnnotateImage` """ client = self.annotator_client self.log.info('Annotating image') r...
[ "For", "the", "documentation", "see", ":", ":", "py", ":", "class", ":", "~airflow", ".", "contrib", ".", "operators", ".", "gcp_vision_image_annotator_operator", ".", "CloudVisionAnnotateImage" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_vision_hook.py#L436-L449
[ "def", "annotate_image", "(", "self", ",", "request", ",", "retry", "=", "None", ",", "timeout", "=", "None", ")", ":", "client", "=", "self", ".", "annotator_client", "self", ".", "log", ".", "info", "(", "'Annotating image'", ")", "response", "=", "cli...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
CloudVisionHook.safe_search_detection
For the documentation see: :py:class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionDetectImageSafeSearchOperator`
airflow/contrib/hooks/gcp_vision_hook.py
def safe_search_detection( self, image, max_results=None, retry=None, timeout=None, additional_properties=None ): """ For the documentation see: :py:class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionDetectImageSafeSearchOperator` """ client = self.annot...
def safe_search_detection( self, image, max_results=None, retry=None, timeout=None, additional_properties=None ): """ For the documentation see: :py:class:`~airflow.contrib.operators.gcp_vision_operator.CloudVisionDetectImageSafeSearchOperator` """ client = self.annot...
[ "For", "the", "documentation", "see", ":", ":", "py", ":", "class", ":", "~airflow", ".", "contrib", ".", "operators", ".", "gcp_vision_operator", ".", "CloudVisionDetectImageSafeSearchOperator" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_vision_hook.py#L527-L548
[ "def", "safe_search_detection", "(", "self", ",", "image", ",", "max_results", "=", "None", ",", "retry", "=", "None", ",", "timeout", "=", "None", ",", "additional_properties", "=", "None", ")", ":", "client", "=", "self", ".", "annotator_client", "self", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
DingdingHook._get_endpoint
Get Dingding endpoint for sending message.
airflow/contrib/hooks/dingding_hook.py
def _get_endpoint(self): """ Get Dingding endpoint for sending message. """ conn = self.get_connection(self.http_conn_id) token = conn.password if not token: raise AirflowException('Dingding token is requests but get nothing, ' ...
def _get_endpoint(self): """ Get Dingding endpoint for sending message. """ conn = self.get_connection(self.http_conn_id) token = conn.password if not token: raise AirflowException('Dingding token is requests but get nothing, ' ...
[ "Get", "Dingding", "endpoint", "for", "sending", "message", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/dingding_hook.py#L65-L74
[ "def", "_get_endpoint", "(", "self", ")", ":", "conn", "=", "self", ".", "get_connection", "(", "self", ".", "http_conn_id", ")", "token", "=", "conn", ".", "password", "if", "not", "token", ":", "raise", "AirflowException", "(", "'Dingding token is requests b...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
DingdingHook._build_message
Build different type of Dingding message As most commonly used type, text message just need post message content rather than a dict like ``{'content': 'message'}``
airflow/contrib/hooks/dingding_hook.py
def _build_message(self): """ Build different type of Dingding message As most commonly used type, text message just need post message content rather than a dict like ``{'content': 'message'}`` """ if self.message_type in ['text', 'markdown']: data = { ...
def _build_message(self): """ Build different type of Dingding message As most commonly used type, text message just need post message content rather than a dict like ``{'content': 'message'}`` """ if self.message_type in ['text', 'markdown']: data = { ...
[ "Build", "different", "type", "of", "Dingding", "message", "As", "most", "commonly", "used", "type", "text", "message", "just", "need", "post", "message", "content", "rather", "than", "a", "dict", "like", "{", "content", ":", "message", "}" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/dingding_hook.py#L76-L98
[ "def", "_build_message", "(", "self", ")", ":", "if", "self", ".", "message_type", "in", "[", "'text'", ",", "'markdown'", "]", ":", "data", "=", "{", "'msgtype'", ":", "self", ".", "message_type", ",", "self", ".", "message_type", ":", "{", "'content'",...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
DingdingHook.send
Send Dingding message
airflow/contrib/hooks/dingding_hook.py
def send(self): """ Send Dingding message """ support_type = ['text', 'link', 'markdown', 'actionCard', 'feedCard'] if self.message_type not in support_type: raise ValueError('DingdingWebhookHook only support {} ' 'so far, but receive {}'....
def send(self): """ Send Dingding message """ support_type = ['text', 'link', 'markdown', 'actionCard', 'feedCard'] if self.message_type not in support_type: raise ValueError('DingdingWebhookHook only support {} ' 'so far, but receive {}'....
[ "Send", "Dingding", "message" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/dingding_hook.py#L115-L134
[ "def", "send", "(", "self", ")", ":", "support_type", "=", "[", "'text'", ",", "'link'", ",", "'markdown'", ",", "'actionCard'", ",", "'feedCard'", "]", "if", "self", ".", "message_type", "not", "in", "support_type", ":", "raise", "ValueError", "(", "'Ding...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
ElasticsearchTaskHandler._read
Endpoint for streaming log. :param ti: task instance object :param try_number: try_number of the task instance :param metadata: log metadata, can be used for steaming log reading and auto-tailing. :return: a list of log documents and metadata.
airflow/utils/log/es_task_handler.py
def _read(self, ti, try_number, metadata=None): """ Endpoint for streaming log. :param ti: task instance object :param try_number: try_number of the task instance :param metadata: log metadata, can be used for steaming log reading and auto-tailing. ...
def _read(self, ti, try_number, metadata=None): """ Endpoint for streaming log. :param ti: task instance object :param try_number: try_number of the task instance :param metadata: log metadata, can be used for steaming log reading and auto-tailing. ...
[ "Endpoint", "for", "streaming", "log", ".", ":", "param", "ti", ":", "task", "instance", "object", ":", "param", "try_number", ":", "try_number", "of", "the", "task", "instance", ":", "param", "metadata", ":", "log", "metadata", "can", "be", "used", "for",...
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/log/es_task_handler.py#L83-L124
[ "def", "_read", "(", "self", ",", "ti", ",", "try_number", ",", "metadata", "=", "None", ")", ":", "if", "not", "metadata", ":", "metadata", "=", "{", "'offset'", ":", "0", "}", "if", "'offset'", "not", "in", "metadata", ":", "metadata", "[", "'offse...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
ElasticsearchTaskHandler.es_read
Returns the logs matching log_id in Elasticsearch and next offset. Returns '' if no log is found or there was an error. :param log_id: the log_id of the log to read. :type log_id: str :param offset: the offset start to read log from. :type offset: str
airflow/utils/log/es_task_handler.py
def es_read(self, log_id, offset): """ Returns the logs matching log_id in Elasticsearch and next offset. Returns '' if no log is found or there was an error. :param log_id: the log_id of the log to read. :type log_id: str :param offset: the offset start to read log from....
def es_read(self, log_id, offset): """ Returns the logs matching log_id in Elasticsearch and next offset. Returns '' if no log is found or there was an error. :param log_id: the log_id of the log to read. :type log_id: str :param offset: the offset start to read log from....
[ "Returns", "the", "logs", "matching", "log_id", "in", "Elasticsearch", "and", "next", "offset", ".", "Returns", "if", "no", "log", "is", "found", "or", "there", "was", "an", "error", ".", ":", "param", "log_id", ":", "the", "log_id", "of", "the", "log", ...
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/log/es_task_handler.py#L126-L152
[ "def", "es_read", "(", "self", ",", "log_id", ",", "offset", ")", ":", "# Offset is the unique key for sorting logs given log_id.", "s", "=", "Search", "(", "using", "=", "self", ".", "client", ")", ".", "query", "(", "'match_phrase'", ",", "log_id", "=", "log...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
_bind_parameters
Helper method that binds parameters to a SQL query.
airflow/contrib/hooks/bigquery_hook.py
def _bind_parameters(operation, parameters): """ Helper method that binds parameters to a SQL query. """ # inspired by MySQL Python Connector (conversion.py) string_parameters = {} for (name, value) in iteritems(parameters): if value is None: string_parameters[name] = 'NULL' ...
def _bind_parameters(operation, parameters): """ Helper method that binds parameters to a SQL query. """ # inspired by MySQL Python Connector (conversion.py) string_parameters = {} for (name, value) in iteritems(parameters): if value is None: string_parameters[name] = 'NULL' ...
[ "Helper", "method", "that", "binds", "parameters", "to", "a", "SQL", "query", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L1948-L1959
[ "def", "_bind_parameters", "(", "operation", ",", "parameters", ")", ":", "# inspired by MySQL Python Connector (conversion.py)", "string_parameters", "=", "{", "}", "for", "(", "name", ",", "value", ")", "in", "iteritems", "(", "parameters", ")", ":", "if", "valu...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
_escape
Helper method that escapes parameters to a SQL query.
airflow/contrib/hooks/bigquery_hook.py
def _escape(s): """ Helper method that escapes parameters to a SQL query. """ e = s e = e.replace('\\', '\\\\') e = e.replace('\n', '\\n') e = e.replace('\r', '\\r') e = e.replace("'", "\\'") e = e.replace('"', '\\"') return e
def _escape(s): """ Helper method that escapes parameters to a SQL query. """ e = s e = e.replace('\\', '\\\\') e = e.replace('\n', '\\n') e = e.replace('\r', '\\r') e = e.replace("'", "\\'") e = e.replace('"', '\\"') return e
[ "Helper", "method", "that", "escapes", "parameters", "to", "a", "SQL", "query", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L1962-L1970
[ "def", "_escape", "(", "s", ")", ":", "e", "=", "s", "e", "=", "e", ".", "replace", "(", "'\\\\'", ",", "'\\\\\\\\'", ")", "e", "=", "e", ".", "replace", "(", "'\\n'", ",", "'\\\\n'", ")", "e", "=", "e", ".", "replace", "(", "'\\r'", ",", "'\...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
_bq_cast
Helper method that casts a BigQuery row to the appropriate data types. This is useful because BigQuery returns all fields as strings.
airflow/contrib/hooks/bigquery_hook.py
def _bq_cast(string_field, bq_type): """ Helper method that casts a BigQuery row to the appropriate data types. This is useful because BigQuery returns all fields as strings. """ if string_field is None: return None elif bq_type == 'INTEGER': return int(string_field) elif bq_...
def _bq_cast(string_field, bq_type): """ Helper method that casts a BigQuery row to the appropriate data types. This is useful because BigQuery returns all fields as strings. """ if string_field is None: return None elif bq_type == 'INTEGER': return int(string_field) elif bq_...
[ "Helper", "method", "that", "casts", "a", "BigQuery", "row", "to", "the", "appropriate", "data", "types", ".", "This", "is", "useful", "because", "BigQuery", "returns", "all", "fields", "as", "strings", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L1973-L1990
[ "def", "_bq_cast", "(", "string_field", ",", "bq_type", ")", ":", "if", "string_field", "is", "None", ":", "return", "None", "elif", "bq_type", "==", "'INTEGER'", ":", "return", "int", "(", "string_field", ")", "elif", "bq_type", "==", "'FLOAT'", "or", "bq...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
_validate_value
function to check expected type and raise error if type is not correct
airflow/contrib/hooks/bigquery_hook.py
def _validate_value(key, value, expected_type): """ function to check expected type and raise error if type is not correct """ if not isinstance(value, expected_type): raise TypeError("{} argument must have a type {} not {}".format( key, expected_type, type(value)))
def _validate_value(key, value, expected_type): """ function to check expected type and raise error if type is not correct """ if not isinstance(value, expected_type): raise TypeError("{} argument must have a type {} not {}".format( key, expected_type, type(value)))
[ "function", "to", "check", "expected", "type", "and", "raise", "error", "if", "type", "is", "not", "correct" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L2071-L2076
[ "def", "_validate_value", "(", "key", ",", "value", ",", "expected_type", ")", ":", "if", "not", "isinstance", "(", "value", ",", "expected_type", ")", ":", "raise", "TypeError", "(", "\"{} argument must have a type {} not {}\"", ".", "format", "(", "key", ",", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigQueryHook.get_conn
Returns a BigQuery PEP 249 connection object.
airflow/contrib/hooks/bigquery_hook.py
def get_conn(self): """ Returns a BigQuery PEP 249 connection object. """ service = self.get_service() project = self._get_field('project') return BigQueryConnection( service=service, project_id=project, use_legacy_sql=self.use_legacy_s...
def get_conn(self): """ Returns a BigQuery PEP 249 connection object. """ service = self.get_service() project = self._get_field('project') return BigQueryConnection( service=service, project_id=project, use_legacy_sql=self.use_legacy_s...
[ "Returns", "a", "BigQuery", "PEP", "249", "connection", "object", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L65-L77
[ "def", "get_conn", "(", "self", ")", ":", "service", "=", "self", ".", "get_service", "(", ")", "project", "=", "self", ".", "_get_field", "(", "'project'", ")", "return", "BigQueryConnection", "(", "service", "=", "service", ",", "project_id", "=", "proje...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigQueryHook.get_service
Returns a BigQuery service object.
airflow/contrib/hooks/bigquery_hook.py
def get_service(self): """ Returns a BigQuery service object. """ http_authorized = self._authorize() return build( 'bigquery', 'v2', http=http_authorized, cache_discovery=False)
def get_service(self): """ Returns a BigQuery service object. """ http_authorized = self._authorize() return build( 'bigquery', 'v2', http=http_authorized, cache_discovery=False)
[ "Returns", "a", "BigQuery", "service", "object", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L79-L85
[ "def", "get_service", "(", "self", ")", ":", "http_authorized", "=", "self", ".", "_authorize", "(", ")", "return", "build", "(", "'bigquery'", ",", "'v2'", ",", "http", "=", "http_authorized", ",", "cache_discovery", "=", "False", ")" ]
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigQueryHook.get_pandas_df
Returns a Pandas DataFrame for the results produced by a BigQuery query. The DbApiHook method must be overridden because Pandas doesn't support PEP 249 connections, except for SQLite. See: https://github.com/pydata/pandas/blob/master/pandas/io/sql.py#L447 https://github.com/pydata/panda...
airflow/contrib/hooks/bigquery_hook.py
def get_pandas_df(self, sql, parameters=None, dialect=None): """ Returns a Pandas DataFrame for the results produced by a BigQuery query. The DbApiHook method must be overridden because Pandas doesn't support PEP 249 connections, except for SQLite. See: https://github.com/pydata...
def get_pandas_df(self, sql, parameters=None, dialect=None): """ Returns a Pandas DataFrame for the results produced by a BigQuery query. The DbApiHook method must be overridden because Pandas doesn't support PEP 249 connections, except for SQLite. See: https://github.com/pydata...
[ "Returns", "a", "Pandas", "DataFrame", "for", "the", "results", "produced", "by", "a", "BigQuery", "query", ".", "The", "DbApiHook", "method", "must", "be", "overridden", "because", "Pandas", "doesn", "t", "support", "PEP", "249", "connections", "except", "for...
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L95-L122
[ "def", "get_pandas_df", "(", "self", ",", "sql", ",", "parameters", "=", "None", ",", "dialect", "=", "None", ")", ":", "private_key", "=", "self", ".", "_get_field", "(", "'key_path'", ",", "None", ")", "or", "self", ".", "_get_field", "(", "'keyfile_di...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigQueryHook.table_exists
Checks for the existence of a table in Google BigQuery. :param project_id: The Google cloud project in which to look for the table. The connection supplied to the hook must provide access to the specified project. :type project_id: str :param dataset_id: The name of the ...
airflow/contrib/hooks/bigquery_hook.py
def table_exists(self, project_id, dataset_id, table_id): """ Checks for the existence of a table in Google BigQuery. :param project_id: The Google cloud project in which to look for the table. The connection supplied to the hook must provide access to the specified proj...
def table_exists(self, project_id, dataset_id, table_id): """ Checks for the existence of a table in Google BigQuery. :param project_id: The Google cloud project in which to look for the table. The connection supplied to the hook must provide access to the specified proj...
[ "Checks", "for", "the", "existence", "of", "a", "table", "in", "Google", "BigQuery", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L124-L147
[ "def", "table_exists", "(", "self", ",", "project_id", ",", "dataset_id", ",", "table_id", ")", ":", "service", "=", "self", ".", "get_service", "(", ")", "try", ":", "service", ".", "tables", "(", ")", ".", "get", "(", "projectId", "=", "project_id", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigQueryBaseCursor.create_empty_table
Creates a new, empty table in the dataset. To create a view, which is defined by a SQL query, parse a dictionary to 'view' kwarg :param project_id: The project to create the table into. :type project_id: str :param dataset_id: The dataset to create the table into. :type dataset_...
airflow/contrib/hooks/bigquery_hook.py
def create_empty_table(self, project_id, dataset_id, table_id, schema_fields=None, time_partitioning=None, cluster_fields=None, lab...
def create_empty_table(self, project_id, dataset_id, table_id, schema_fields=None, time_partitioning=None, cluster_fields=None, lab...
[ "Creates", "a", "new", "empty", "table", "in", "the", "dataset", ".", "To", "create", "a", "view", "which", "is", "defined", "by", "a", "SQL", "query", "parse", "a", "dictionary", "to", "view", "kwarg" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L229-L328
[ "def", "create_empty_table", "(", "self", ",", "project_id", ",", "dataset_id", ",", "table_id", ",", "schema_fields", "=", "None", ",", "time_partitioning", "=", "None", ",", "cluster_fields", "=", "None", ",", "labels", "=", "None", ",", "view", "=", "None...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigQueryBaseCursor.create_external_table
Creates a new external table in the dataset with the data in Google Cloud Storage. See here: https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#resource for more details about these parameters. :param external_project_dataset_table: The dotted ``(<project>.|<p...
airflow/contrib/hooks/bigquery_hook.py
def create_external_table(self, external_project_dataset_table, schema_fields, source_uris, source_format='CSV', autodetect=False, compressi...
def create_external_table(self, external_project_dataset_table, schema_fields, source_uris, source_format='CSV', autodetect=False, compressi...
[ "Creates", "a", "new", "external", "table", "in", "the", "dataset", "with", "the", "data", "in", "Google", "Cloud", "Storage", ".", "See", "here", ":" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L330-L524
[ "def", "create_external_table", "(", "self", ",", "external_project_dataset_table", ",", "schema_fields", ",", "source_uris", ",", "source_format", "=", "'CSV'", ",", "autodetect", "=", "False", ",", "compression", "=", "'NONE'", ",", "ignore_unknown_values", "=", "...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigQueryBaseCursor.patch_table
Patch information in an existing table. It only updates fileds that are provided in the request object. Reference: https://cloud.google.com/bigquery/docs/reference/rest/v2/tables/patch :param dataset_id: The dataset containing the table to be patched. :type dataset_id: str :par...
airflow/contrib/hooks/bigquery_hook.py
def patch_table(self, dataset_id, table_id, project_id=None, description=None, expiration_time=None, external_data_configuration=None, friendly_name=None, label...
def patch_table(self, dataset_id, table_id, project_id=None, description=None, expiration_time=None, external_data_configuration=None, friendly_name=None, label...
[ "Patch", "information", "in", "an", "existing", "table", ".", "It", "only", "updates", "fileds", "that", "are", "provided", "in", "the", "request", "object", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L526-L632
[ "def", "patch_table", "(", "self", ",", "dataset_id", ",", "table_id", ",", "project_id", "=", "None", ",", "description", "=", "None", ",", "expiration_time", "=", "None", ",", "external_data_configuration", "=", "None", ",", "friendly_name", "=", "None", ","...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigQueryBaseCursor.run_query
Executes a BigQuery SQL query. Optionally persists results in a BigQuery table. See here: https://cloud.google.com/bigquery/docs/reference/v2/jobs For more details about these parameters. :param sql: The BigQuery SQL to execute. :type sql: str :param destination_datase...
airflow/contrib/hooks/bigquery_hook.py
def run_query(self, sql, destination_dataset_table=None, write_disposition='WRITE_EMPTY', allow_large_results=False, flatten_results=None, udf_config=None, use_legacy_sql=None, ...
def run_query(self, sql, destination_dataset_table=None, write_disposition='WRITE_EMPTY', allow_large_results=False, flatten_results=None, udf_config=None, use_legacy_sql=None, ...
[ "Executes", "a", "BigQuery", "SQL", "query", ".", "Optionally", "persists", "results", "in", "a", "BigQuery", "table", ".", "See", "here", ":" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L634-L853
[ "def", "run_query", "(", "self", ",", "sql", ",", "destination_dataset_table", "=", "None", ",", "write_disposition", "=", "'WRITE_EMPTY'", ",", "allow_large_results", "=", "False", ",", "flatten_results", "=", "None", ",", "udf_config", "=", "None", ",", "use_l...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigQueryBaseCursor.run_extract
Executes a BigQuery extract command to copy data from BigQuery to Google Cloud Storage. See here: https://cloud.google.com/bigquery/docs/reference/v2/jobs For more details about these parameters. :param source_project_dataset_table: The dotted ``<dataset>.<table>`` BigQuer...
airflow/contrib/hooks/bigquery_hook.py
def run_extract( # noqa self, source_project_dataset_table, destination_cloud_storage_uris, compression='NONE', export_format='CSV', field_delimiter=',', print_header=True, labels=None): """ Executes a BigQu...
def run_extract( # noqa self, source_project_dataset_table, destination_cloud_storage_uris, compression='NONE', export_format='CSV', field_delimiter=',', print_header=True, labels=None): """ Executes a BigQu...
[ "Executes", "a", "BigQuery", "extract", "command", "to", "copy", "data", "from", "BigQuery", "to", "Google", "Cloud", "Storage", ".", "See", "here", ":" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L855-L921
[ "def", "run_extract", "(", "# noqa", "self", ",", "source_project_dataset_table", ",", "destination_cloud_storage_uris", ",", "compression", "=", "'NONE'", ",", "export_format", "=", "'CSV'", ",", "field_delimiter", "=", "','", ",", "print_header", "=", "True", ",",...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigQueryBaseCursor.run_copy
Executes a BigQuery copy command to copy data from one BigQuery table to another. See here: https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.copy For more details about these parameters. :param source_project_dataset_tables: One or more dotted ``(proj...
airflow/contrib/hooks/bigquery_hook.py
def run_copy(self, source_project_dataset_tables, destination_project_dataset_table, write_disposition='WRITE_EMPTY', create_disposition='CREATE_IF_NEEDED', labels=None): """ Executes a BigQuery copy command to copy dat...
def run_copy(self, source_project_dataset_tables, destination_project_dataset_table, write_disposition='WRITE_EMPTY', create_disposition='CREATE_IF_NEEDED', labels=None): """ Executes a BigQuery copy command to copy dat...
[ "Executes", "a", "BigQuery", "copy", "command", "to", "copy", "data", "from", "one", "BigQuery", "table", "to", "another", ".", "See", "here", ":" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L923-L994
[ "def", "run_copy", "(", "self", ",", "source_project_dataset_tables", ",", "destination_project_dataset_table", ",", "write_disposition", "=", "'WRITE_EMPTY'", ",", "create_disposition", "=", "'CREATE_IF_NEEDED'", ",", "labels", "=", "None", ")", ":", "source_project_data...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigQueryBaseCursor.run_load
Executes a BigQuery load command to load data from Google Cloud Storage to BigQuery. See here: https://cloud.google.com/bigquery/docs/reference/v2/jobs For more details about these parameters. :param destination_project_dataset_table: The dotted ``(<project>.|<project>:)<d...
airflow/contrib/hooks/bigquery_hook.py
def run_load(self, destination_project_dataset_table, source_uris, schema_fields=None, source_format='CSV', create_disposition='CREATE_IF_NEEDED', skip_leading_rows=0, write_disposition='WRITE_EMPTY', ...
def run_load(self, destination_project_dataset_table, source_uris, schema_fields=None, source_format='CSV', create_disposition='CREATE_IF_NEEDED', skip_leading_rows=0, write_disposition='WRITE_EMPTY', ...
[ "Executes", "a", "BigQuery", "load", "command", "to", "load", "data", "from", "Google", "Cloud", "Storage", "to", "BigQuery", ".", "See", "here", ":" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L996-L1209
[ "def", "run_load", "(", "self", ",", "destination_project_dataset_table", ",", "source_uris", ",", "schema_fields", "=", "None", ",", "source_format", "=", "'CSV'", ",", "create_disposition", "=", "'CREATE_IF_NEEDED'", ",", "skip_leading_rows", "=", "0", ",", "write...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigQueryBaseCursor.run_with_configuration
Executes a BigQuery SQL query. See here: https://cloud.google.com/bigquery/docs/reference/v2/jobs For more details about the configuration parameter. :param configuration: The configuration parameter maps directly to BigQuery's configuration field in the job object. See ...
airflow/contrib/hooks/bigquery_hook.py
def run_with_configuration(self, configuration): """ Executes a BigQuery SQL query. See here: https://cloud.google.com/bigquery/docs/reference/v2/jobs For more details about the configuration parameter. :param configuration: The configuration parameter maps directly to ...
def run_with_configuration(self, configuration): """ Executes a BigQuery SQL query. See here: https://cloud.google.com/bigquery/docs/reference/v2/jobs For more details about the configuration parameter. :param configuration: The configuration parameter maps directly to ...
[ "Executes", "a", "BigQuery", "SQL", "query", ".", "See", "here", ":" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L1211-L1273
[ "def", "run_with_configuration", "(", "self", ",", "configuration", ")", ":", "jobs", "=", "self", ".", "service", ".", "jobs", "(", ")", "job_data", "=", "{", "'configuration'", ":", "configuration", "}", "# Send query and wait for reply.", "query_reply", "=", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigQueryBaseCursor.cancel_query
Cancel all started queries that have not yet completed
airflow/contrib/hooks/bigquery_hook.py
def cancel_query(self): """ Cancel all started queries that have not yet completed """ jobs = self.service.jobs() if (self.running_job_id and not self.poll_job_complete(self.running_job_id)): self.log.info('Attempting to cancel job : %s, %s', self.proj...
def cancel_query(self): """ Cancel all started queries that have not yet completed """ jobs = self.service.jobs() if (self.running_job_id and not self.poll_job_complete(self.running_job_id)): self.log.info('Attempting to cancel job : %s, %s', self.proj...
[ "Cancel", "all", "started", "queries", "that", "have", "not", "yet", "completed" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L1298-L1339
[ "def", "cancel_query", "(", "self", ")", ":", "jobs", "=", "self", ".", "service", ".", "jobs", "(", ")", "if", "(", "self", ".", "running_job_id", "and", "not", "self", ".", "poll_job_complete", "(", "self", ".", "running_job_id", ")", ")", ":", "self...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigQueryBaseCursor.get_schema
Get the schema for a given datset.table. see https://cloud.google.com/bigquery/docs/reference/v2/tables#resource :param dataset_id: the dataset ID of the requested table :param table_id: the table ID of the requested table :return: a table schema
airflow/contrib/hooks/bigquery_hook.py
def get_schema(self, dataset_id, table_id): """ Get the schema for a given datset.table. see https://cloud.google.com/bigquery/docs/reference/v2/tables#resource :param dataset_id: the dataset ID of the requested table :param table_id: the table ID of the requested table ...
def get_schema(self, dataset_id, table_id): """ Get the schema for a given datset.table. see https://cloud.google.com/bigquery/docs/reference/v2/tables#resource :param dataset_id: the dataset ID of the requested table :param table_id: the table ID of the requested table ...
[ "Get", "the", "schema", "for", "a", "given", "datset", ".", "table", ".", "see", "https", ":", "//", "cloud", ".", "google", ".", "com", "/", "bigquery", "/", "docs", "/", "reference", "/", "v2", "/", "tables#resource" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L1341-L1353
[ "def", "get_schema", "(", "self", ",", "dataset_id", ",", "table_id", ")", ":", "tables_resource", "=", "self", ".", "service", ".", "tables", "(", ")", ".", "get", "(", "projectId", "=", "self", ".", "project_id", ",", "datasetId", "=", "dataset_id", ",...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigQueryBaseCursor.get_tabledata
Get the data of a given dataset.table and optionally with selected columns. see https://cloud.google.com/bigquery/docs/reference/v2/tabledata/list :param dataset_id: the dataset ID of the requested table. :param table_id: the table ID of the requested table. :param max_results: the maxi...
airflow/contrib/hooks/bigquery_hook.py
def get_tabledata(self, dataset_id, table_id, max_results=None, selected_fields=None, page_token=None, start_index=None): """ Get the data of a given dataset.table and optionally with selected columns. see https://cloud.google.com/bigquery/docs/referen...
def get_tabledata(self, dataset_id, table_id, max_results=None, selected_fields=None, page_token=None, start_index=None): """ Get the data of a given dataset.table and optionally with selected columns. see https://cloud.google.com/bigquery/docs/referen...
[ "Get", "the", "data", "of", "a", "given", "dataset", ".", "table", "and", "optionally", "with", "selected", "columns", ".", "see", "https", ":", "//", "cloud", ".", "google", ".", "com", "/", "bigquery", "/", "docs", "/", "reference", "/", "v2", "/", ...
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L1355-L1385
[ "def", "get_tabledata", "(", "self", ",", "dataset_id", ",", "table_id", ",", "max_results", "=", "None", ",", "selected_fields", "=", "None", ",", "page_token", "=", "None", ",", "start_index", "=", "None", ")", ":", "optional_params", "=", "{", "}", "if"...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigQueryBaseCursor.run_table_delete
Delete an existing table from the dataset; If the table does not exist, return an error unless ignore_if_missing is set to True. :param deletion_dataset_table: A dotted ``(<project>.|<project>:)<dataset>.<table>`` that indicates which table will be deleted. :type...
airflow/contrib/hooks/bigquery_hook.py
def run_table_delete(self, deletion_dataset_table, ignore_if_missing=False): """ Delete an existing table from the dataset; If the table does not exist, return an error unless ignore_if_missing is set to True. :param deletion_dataset_table: A dotted ...
def run_table_delete(self, deletion_dataset_table, ignore_if_missing=False): """ Delete an existing table from the dataset; If the table does not exist, return an error unless ignore_if_missing is set to True. :param deletion_dataset_table: A dotted ...
[ "Delete", "an", "existing", "table", "from", "the", "dataset", ";", "If", "the", "table", "does", "not", "exist", "return", "an", "error", "unless", "ignore_if_missing", "is", "set", "to", "True", "." ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L1387-L1419
[ "def", "run_table_delete", "(", "self", ",", "deletion_dataset_table", ",", "ignore_if_missing", "=", "False", ")", ":", "deletion_project", ",", "deletion_dataset", ",", "deletion_table", "=", "_split_tablename", "(", "table_input", "=", "deletion_dataset_table", ",", ...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigQueryBaseCursor.run_table_upsert
creates a new, empty table in the dataset; If the table already exists, update the existing table. Since BigQuery does not natively allow table upserts, this is not an atomic operation. :param dataset_id: the dataset to upsert the table into. :type dataset_id: str :param...
airflow/contrib/hooks/bigquery_hook.py
def run_table_upsert(self, dataset_id, table_resource, project_id=None): """ creates a new, empty table in the dataset; If the table already exists, update the existing table. Since BigQuery does not natively allow table upserts, this is not an atomic operation. :param d...
def run_table_upsert(self, dataset_id, table_resource, project_id=None): """ creates a new, empty table in the dataset; If the table already exists, update the existing table. Since BigQuery does not natively allow table upserts, this is not an atomic operation. :param d...
[ "creates", "a", "new", "empty", "table", "in", "the", "dataset", ";", "If", "the", "table", "already", "exists", "update", "the", "existing", "table", ".", "Since", "BigQuery", "does", "not", "natively", "allow", "table", "upserts", "this", "is", "not", "a...
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L1421-L1468
[ "def", "run_table_upsert", "(", "self", ",", "dataset_id", ",", "table_resource", ",", "project_id", "=", "None", ")", ":", "# check to see if the table exists", "table_id", "=", "table_resource", "[", "'tableReference'", "]", "[", "'tableId'", "]", "project_id", "=...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigQueryBaseCursor.run_grant_dataset_view_access
Grant authorized view access of a dataset to a view table. If this view has already been granted access to the dataset, do nothing. This method is not atomic. Running it may clobber a simultaneous update. :param source_dataset: the source dataset :type source_dataset: str :para...
airflow/contrib/hooks/bigquery_hook.py
def run_grant_dataset_view_access(self, source_dataset, view_dataset, view_table, source_project=None, view_project=None): ...
def run_grant_dataset_view_access(self, source_dataset, view_dataset, view_table, source_project=None, view_project=None): ...
[ "Grant", "authorized", "view", "access", "of", "a", "dataset", "to", "a", "view", "table", ".", "If", "this", "view", "has", "already", "been", "granted", "access", "to", "the", "dataset", "do", "nothing", ".", "This", "method", "is", "not", "atomic", "....
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L1470-L1531
[ "def", "run_grant_dataset_view_access", "(", "self", ",", "source_dataset", ",", "view_dataset", ",", "view_table", ",", "source_project", "=", "None", ",", "view_project", "=", "None", ")", ":", "# Apply default values to projects", "source_project", "=", "source_proje...
b69c686ad8a0c89b9136bb4b31767257eb7b2597
test
BigQueryBaseCursor.create_empty_dataset
Create a new empty dataset: https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets/insert :param project_id: The name of the project where we want to create an empty a dataset. Don't need to provide, if projectId in dataset_reference. :type project_id: str :param ...
airflow/contrib/hooks/bigquery_hook.py
def create_empty_dataset(self, dataset_id="", project_id="", dataset_reference=None): """ Create a new empty dataset: https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets/insert :param project_id: The name of the project where we want to create ...
def create_empty_dataset(self, dataset_id="", project_id="", dataset_reference=None): """ Create a new empty dataset: https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets/insert :param project_id: The name of the project where we want to create ...
[ "Create", "a", "new", "empty", "dataset", ":", "https", ":", "//", "cloud", ".", "google", ".", "com", "/", "bigquery", "/", "docs", "/", "reference", "/", "rest", "/", "v2", "/", "datasets", "/", "insert" ]
apache/airflow
python
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/bigquery_hook.py#L1533-L1598
[ "def", "create_empty_dataset", "(", "self", ",", "dataset_id", "=", "\"\"", ",", "project_id", "=", "\"\"", ",", "dataset_reference", "=", "None", ")", ":", "if", "dataset_reference", ":", "_validate_value", "(", "'dataset_reference'", ",", "dataset_reference", ",...
b69c686ad8a0c89b9136bb4b31767257eb7b2597