As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Types for Google Cloud Dataqna v1alpha API

class google.cloud.dataqna_v1alpha.types.AnnotatedString(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Describes string annotation from both semantic and formatting perspectives. Example:

User Query:

top countries by population in Africa

0 4 14 17 28 31 37

Table Data:

  • “country” - dimension

  • “population” - metric

  • “Africa” - value in the “continent” column

text_formatted = "top countries by population in Africa"

html_formatted = "top <b>countries</b> by <b>population</b> in <i>Africa</i>"

markups = [
  {DIMENSION, 4, 12}, // 'countries'
  {METRIC, 17, 26}, // 'population'
  {FILTER, 31, 36}  // 'Africa'
]

Note that html formattings for ‘DIMENSION’ and ‘METRIC’ are the same, while semantic markups are different.

text_formatted

Text version of the string.

Type

str

html_formatted

HTML version of the string annotation.

Type

str

markups

Semantic version of the string annotation.

Type

MutableSequence[google.cloud.dataqna_v1alpha.types.AnnotatedString.SemanticMarkup]

class SemanticMarkup(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Semantic markup denotes a substring (by index and length) with markup information.

type_

The semantic type of the markup substring.

Type

google.cloud.dataqna_v1alpha.types.AnnotatedString.SemanticMarkupType

start_char_index

Unicode character index of the query.

Type

int

length

The length (number of unicode characters) of the markup substring.

Type

int

class SemanticMarkupType(value)[source]

Bases: proto.enums.Enum

Semantic markup types.

Values:
MARKUP_TYPE_UNSPECIFIED (0):

No markup type was specified.

METRIC (1):

Markup for a substring denoting a metric.

DIMENSION (2):

Markup for a substring denoting a dimension.

FILTER (3):

Markup for a substring denoting a filter.

UNUSED (4):

Markup for an unused substring.

BLOCKED (5):

Markup for a substring containing blocked phrases.

ROW (6):

Markup for a substring that contains terms for row.

class google.cloud.dataqna_v1alpha.types.BigQueryJob(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

BigQuery job information. This can be used to query the BigQuery API and retrieve the current job’s status (using jobs.get).

job_id

The job ID.

Type

str

project_id

The project ID of the job.

Type

str

location

The location where the job is running.

Type

str

class google.cloud.dataqna_v1alpha.types.CreateQuestionRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request to create a question resource.

parent

Required. The name of the project this data source reference belongs to. Example: projects/foo/locations/bar

Type

str

question

Required. The question to create.

Type

google.cloud.dataqna_v1alpha.types.Question

class google.cloud.dataqna_v1alpha.types.DataQuery(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Representation of the data query for the backend. This is provided for informational purposes only. Clients should not use it to send it to the backend directly, but rather use the execute RPC to trigger the execution. Using the execute RPC is needed in order to track the state of a question and report on it correctly to the data administrators.

sql

The generated SQL query to be sent to the backend.

Type

str

class google.cloud.dataqna_v1alpha.types.DebugFlags(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Configuriation of debug flags.

include_va_query

Whether to include the original VAQuery.

Type

bool

include_nested_va_query

Whether to include the original nested VAQuery.

Type

bool

include_human_interpretation

Whether to include the original human interpretation strings generated by Analyza.

Type

bool

include_aqua_debug_response

Whether to include the Aqua debug response.

Type

bool

time_override

The time in milliseconds from Unix epoch to be used to process the query. This is useful for testing the queries at different time period. If not set or time_override <= 0, then the current time is used.

Type

int

is_internal_google_user

Set to true if request is initiated by an internal Google user.

Type

bool

ignore_cache

Determines whether cache needs to be ignored. If set to true, cache won’t be queried and updated.

Type

bool

include_search_entities_rpc

Whether to include the request/response pair from the call to the EntityIndex for SearchEntities.

Type

bool

include_list_column_annotations_rpc

Whether to include the request/response pair from the call to the Annotations service for ListColumnAnnotations.

Type

bool

include_virtual_analyst_entities

Whether to include the entity list passed to Analyza.

Type

bool

include_table_list

Whether to include the table list.

Type

bool

include_domain_list

Whether to include the domain list.

Type

bool

class google.cloud.dataqna_v1alpha.types.ExecuteQuestionRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request to execute an interpretation.

name

Required. The unique identifier for the question. Example: projects/foo/locations/bar/questions/1234

Type

str

interpretation_index

Required. Index of the interpretation to execute.

Type

int

class google.cloud.dataqna_v1alpha.types.ExecutionInfo(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Information about the backend status (such as BigQuery) of the execution.

job_creation_status

Status returned by the backend when the job was created.

Type

google.rpc.status_pb2.Status

job_execution_state

Status of the job execution.

Type

google.cloud.dataqna_v1alpha.types.ExecutionInfo.JobExecutionState

create_time

Time when the execution was triggered.

Type

google.protobuf.timestamp_pb2.Timestamp

bigquery_job

BigQuery job information. Future versions will have different backends. Hence, clients must make sure they can handle it when this field is not populated.

Type

google.cloud.dataqna_v1alpha.types.BigQueryJob

class JobExecutionState(value)[source]

Bases: proto.enums.Enum

Enum of possible job execution statuses.

Values:
JOB_EXECUTION_STATE_UNSPECIFIED (0):

No job execution was specified.

NOT_EXECUTED (1):

No job execution was requested, yet.

RUNNING (2):

The job is running.

SUCCEEDED (3):

The job completed successfully.

FAILED (4):

The job completed unsuccessfully.

class google.cloud.dataqna_v1alpha.types.GetQuestionRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A request to get a previously created question.

name

Required. The unique identifier for the question. Example: projects/foo/locations/bar/questions/1234

Type

str

read_mask

The list of fields to be retrieved.

Type

google.protobuf.field_mask_pb2.FieldMask

class google.cloud.dataqna_v1alpha.types.GetUserFeedbackRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request to get user feedback.

name

Required. The unique identifier for the user feedback. User feedback is a singleton resource on a Question. Example: projects/foo/locations/bar/questions/1234/userFeedback

Type

str

class google.cloud.dataqna_v1alpha.types.HumanReadable(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Human readable interpretation.

generated_interpretation

Generated query explaining the interpretation.

Type

google.cloud.dataqna_v1alpha.types.AnnotatedString

original_question

Annotations on the original query.

Type

google.cloud.dataqna_v1alpha.types.AnnotatedString

class google.cloud.dataqna_v1alpha.types.InterpretEntity(value)[source]

Bases: proto.enums.Enum

Query entities of an interpretation.

Values:
INTERPRET_ENTITY_UNSPECIFIED (0):

No interpret entity was specified.

DIMENSION (1):

A dimenstion entity.

METRIC (2):

A metric entity.

class google.cloud.dataqna_v1alpha.types.InterpretError(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Details on the failure to interpret the question.

message

Error message explaining why this question could not be interpreted.

Type

str

code

The code for the error category why the interpretation failed.

Type

google.cloud.dataqna_v1alpha.types.InterpretError.InterpretErrorCode

details

Details on interpretation failure.

Type

google.cloud.dataqna_v1alpha.types.InterpretError.InterpretErrorDetails

class InterpretAmbiguityDetails(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Details about a query that was too ambiguous. Currently, the message has no fields and its presence signals that there was ambiguity.

class InterpretErrorCode(value)[source]

Bases: proto.enums.Enum

The interpret error code provides an error category why the interpretation failed.

Values:
INTERPRET_ERROR_CODE_UNSPECIFIED (0):

No interpret error code was specified.

INVALID_QUERY (1):

The query is not valid.

FAILED_TO_UNDERSTAND (2):

The interpreter failed to understand the question. For example, because it was too ambiguous.

FAILED_TO_ANSWER (3):

The interpreter could understand the question, but was not able to arrive at an answer. For example, because a requested operation is not supported.

class InterpretErrorDetails(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Details on interpretation failure.

unsupported_details

Populated if parts of the query are unsupported.

Type

google.cloud.dataqna_v1alpha.types.InterpretError.InterpretUnsupportedDetails

incomplete_query_details

Populated if the query is incomplete.

Type

google.cloud.dataqna_v1alpha.types.InterpretError.InterpretIncompleteQueryDetails

ambiguity_details

Populated if the query was too ambiguous.

Type

google.cloud.dataqna_v1alpha.types.InterpretError.InterpretAmbiguityDetails

class InterpretIncompleteQueryDetails(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Details about an incomplete query.

entities

List of missing interpret entities.

Type

MutableSequence[google.cloud.dataqna_v1alpha.types.InterpretEntity]

class InterpretUnsupportedDetails(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Details about unsupported parts in a query.

operators

Unsupported operators. For example: median.

Type

MutableSequence[str]

intent

Unsupported intents.

Type

MutableSequence[str]

class google.cloud.dataqna_v1alpha.types.Interpretation(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

An interpretation of a natural language query.

data_sources

List of data sources used in the current understanding.

Type

MutableSequence[str]

confidence

The level of confidence that one of the interpretations is correct. This is a value in the range [0, 1] where a value of 0.5 or below is to be considered a low confidence.

Type

float

unused_phrases

A list of unused phrases. Clients should display a Did You Mean (DYM) dialog if this is non-empty, even if this is the only interpretation.

Type

MutableSequence[str]

human_readable

Human readable representation of the query.

Type

google.cloud.dataqna_v1alpha.types.HumanReadable

interpretation_structure

Information about the interpretation structure that helps to understand and visualize the response.

Type

google.cloud.dataqna_v1alpha.types.InterpretationStructure

data_query

Representation of the data query to be sent to the backend.

Type

google.cloud.dataqna_v1alpha.types.DataQuery

execution_info

Information about the backend response. This is populated only if execution of an interpretation was requested.

Type

google.cloud.dataqna_v1alpha.types.ExecutionInfo

class google.cloud.dataqna_v1alpha.types.InterpretationStructure(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Information about the interpretation structure that helps to understand and visualize the response.

visualization_types

List of possible visualization types to apply for this interpretation. The order has no relevance.

Type

MutableSequence[google.cloud.dataqna_v1alpha.types.InterpretationStructure.VisualizationType]

column_info

Information about the output columns, that is, the columns that will be returned by the backend.

Type

MutableSequence[google.cloud.dataqna_v1alpha.types.InterpretationStructure.ColumnInfo]

class ColumnInfo(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Information about a column.

output_alias

The alias of the output column as used by the backend. For example, the field name in the schema provided in the query response in BigQuery.

Type

str

display_name

Human readable name of the output column.

Type

str

class VisualizationType(value)[source]

Bases: proto.enums.Enum

Enumeration of visualzation types to use for query response data.

Values:
VISUALIZATION_TYPE_UNSPECIFIED (0):

No visualization type was specified.

TABLE (1):

Show a table.

BAR_CHART (2):

Show a bar chart.

COLUMN_CHART (3):

Show a column chart.

TIMELINE (4):

Show a timeline.

SCATTER_PLOT (5):

Show a scatter plot.

PIE_CHART (6):

Show a pie chart.

LINE_CHART (7):

Show a line chart.

AREA_CHART (8):

Show an area chart.

COMBO_CHART (9):

Show a combo chart.

HISTOGRAM (10):

Show a histogram.

GENERIC_CHART (11):

This denotes queries when the user has not specified the particular type of chart and has mentioned only a generic chart name such as “Chart”, “Plot”, “Graph”, etc. This will differentiate it from specific charting terms such as “Bar chart”, “Pie chart”, etc.

CHART_NOT_UNDERSTOOD (12):

The user tried to specify a chart type, but the interpreter could not understand the type. The client should display a generic chart and may give a hint to the user that the requested type was not understood.

class google.cloud.dataqna_v1alpha.types.Question(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The question resource represents a natural language query, its settings, understanding generated by the system, and answer retrieval status. A question cannot be modified.

name

Output only. Immutable. The unique identifier for the Question. The ID is server-generated. Example: projects/foo/locations/bar/questions/123

Type

str

scopes

Required. Immutable. Scopes to be used for the question. A scope defines the relevant data set scope. It can be a reference to a specific data source or a collection of data sources. Currently, support is limited to a single BigQuery table. There must be exactly one scopes element.

Example: //bigquery.googleapis.com/projects/test-project/datasets/foo/tables/bar

Type

MutableSequence[str]

query

Required. Immutable. The query in natural language.

Type

str

data_source_annotations

A list of annotations to use instead of the default annotation of a data source (set in the data source reference resource). There must not be more than one annotation with the same data source reference.

Type

MutableSequence[str]

interpret_error

An error field explaining why interpretation failed. This is only populated if the interpretation failed.

Note: This is different from getting a status error on the request itself. This is not a client or server error and the Question resource is still persisted, but the service could not interpret the question. Clients should present the error to the user so the user can rephrase the question.

Type

google.cloud.dataqna_v1alpha.types.InterpretError

interpretations

A list of interpretations for this question.

Type

MutableSequence[google.cloud.dataqna_v1alpha.types.Interpretation]

create_time

Time when the question was created.

Type

google.protobuf.timestamp_pb2.Timestamp

user_email

Output only. The e-mail address of the user that created this question.

Type

str

debug_flags

Input only. Immutable. Flags to request additional information for debugging purposes.

Type

google.cloud.dataqna_v1alpha.types.DebugFlags

debug_info

Top level debug information. This will be stored as the type DebugInformation. Using Any so clients don’t need to pull in anything inside the debug message.

Type

google.protobuf.any_pb2.Any

class google.cloud.dataqna_v1alpha.types.SuggestQueriesRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request for query suggestions.

parent

Required. The parent of the suggestion query is the resource denoting the project and location.

Type

str

scopes

The scopes to which this search is restricted. The only supported scope pattern is //bigquery.googleapis.com/projects/{GCP-PROJECT-ID}/datasets/{DATASET-ID}/tables/{TABLE-ID}.

Type

MutableSequence[str]

query

User query for which to generate suggestions. If the query is empty, zero state suggestions are returned. This allows UIs to display suggestions right away, helping the user to get a sense of what a query might look like.

Type

str

suggestion_types

The requested suggestion type. Multiple suggestion types can be requested, but there is no guarantee that the service will return suggestions for each type. Suggestions for a requested type might rank lower than suggestions for other types and the service may decide to cut these suggestions off.

Type

MutableSequence[google.cloud.dataqna_v1alpha.types.SuggestionType]

class google.cloud.dataqna_v1alpha.types.SuggestQueriesResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Response to SuggestQueries.

suggestions

A list of suggestions.

Type

MutableSequence[google.cloud.dataqna_v1alpha.types.Suggestion]

class google.cloud.dataqna_v1alpha.types.Suggestion(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A suggestion for a query with a ranking score.

suggestion_info

Detailed information about the suggestion.

Type

google.cloud.dataqna_v1alpha.types.SuggestionInfo

ranking_score

The score of the suggestion. This can be used to define ordering in UI. The score represents confidence in the suggestion where higher is better. All score values must be in the range [0, 1).

Type

float

suggestion_type

The type of the suggestion.

Type

google.cloud.dataqna_v1alpha.types.SuggestionType

class google.cloud.dataqna_v1alpha.types.SuggestionInfo(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Detailed information about the suggestion.

annotated_suggestion

Annotations for the suggestion. This provides information about which part of the suggestion corresponds to what semantic meaning (e.g. a metric).

Type

google.cloud.dataqna_v1alpha.types.AnnotatedString

query_matches

Matches between user query and the annotated string.

Type

MutableSequence[google.cloud.dataqna_v1alpha.types.SuggestionInfo.MatchInfo]

class MatchInfo(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

MatchInfo describes which part of suggestion matched with data in user typed query. This can be used to highlight matching parts in the UI. This is different from the annotations provided in annotated_suggestion. The annotated_suggestion provides information about the semantic meaning, while this provides information about how it relates to the input.

Example: user query: top products

annotated_suggestion {
 text_formatted = "top product_group"
 html_formatted = "top <b>product_group</b>"
 markups {
  {type: TEXT, start_char_index: 0, length: 3}
  {type: DIMENSION, start_char_index: 4, length: 13}
 }
}

query_matches {
 { start_char_index: 0, length: 3 }
 { start_char_index: 4, length: 7}
}
start_char_index

Unicode character index of the string annotation.

Type

int

length

Count of unicode characters of this substring.

Type

int

class google.cloud.dataqna_v1alpha.types.SuggestionType(value)[source]

Bases: proto.enums.Enum

The type of suggestion.

Values:
SUGGESTION_TYPE_UNSPECIFIED (0):

No suggestiont type is specified.

ENTITY (1):

Entity suggestion type. Suggestions are for single entities.

TEMPLATE (2):

Template suggestion type. Suggestions are for full sentences.

class google.cloud.dataqna_v1alpha.types.UpdateUserFeedbackRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Request to updates user feedback.

user_feedback

Required. The user feedback to update. This can be called even if there is no user feedback so far. The feedback’s name field is used to identify the user feedback (and the corresponding question) to update.

Type

google.cloud.dataqna_v1alpha.types.UserFeedback

update_mask

The list of fields to be updated.

Type

google.protobuf.field_mask_pb2.FieldMask

class google.cloud.dataqna_v1alpha.types.UserFeedback(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Feedback provided by a user.

name

Required. The unique identifier for the user feedback. User feedback is a singleton resource on a Question. Example: projects/foo/locations/bar/questions/1234/userFeedback

Type

str

free_form_feedback

Free form user feedback, such as a text box.

Type

str

rating

The user feedback rating

Type

google.cloud.dataqna_v1alpha.types.UserFeedback.UserFeedbackRating

class UserFeedbackRating(value)[source]

Bases: proto.enums.Enum

Enumeration of feedback ratings.

Values:
USER_FEEDBACK_RATING_UNSPECIFIED (0):

No rating was specified.

POSITIVE (1):

The user provided positive feedback.

NEGATIVE (2):

The user provided negative feedback.