google-cloud-rust icon indicating copy to clipboard operation
google-cloud-rust copied to clipboard

[bigquery] emulator support

Open LeoCBS opened this issue 8 months ago • 3 comments

Hi @yoshidan , did you test the Bigquery job API? I am trying to use emulator to insert a job to load data into a table, but emulator returning this error:

2025-04-23T19:00:55.251Z        ERROR   server/handler.go:2833  internalError   {"error": "internalError: unexpected request path: /bigquery/v2/projects/jobs"}

LeoCBS avatar Apr 27 '25 11:04 LeoCBS

Support for the bigquery emulator is incomplete.

I have been running tests with the following, but have not tried jobs insert. https://github.com/yoshidan/google-cloud-rust/blob/2e2c08f08b92ffe8f33a70aac991a1a895704fb8/bigquery/src/client.rs#L1344

yoshidan avatar Apr 28 '25 10:04 yoshidan

@yoshidan I tried querying the sample dataset used in the emulator and get the following error:

JobHttp(HttpClient(reqwest::Error { kind: Decode, source: Error("missing field `kind`", line: 1, column: 348) }))

Any thoughts on this?

The query request:

let request = QueryRequest {
    query: "SELECT * FROM test.dataset1.table_a".to_string(),
    ..Default::default()
};

let mut iter = client.query::<Row>(&self.project_id, request).await.unwrap();

ddimaria avatar May 08 '25 17:05 ddimaria

@ddimaria Unlike the GCP environment, emulator does not seem to return kind or etag. Therefore, it may work if you give #[serde(default)] or make it an Option type. https://github.com/yoshidan/google-cloud-rust/blob/be801d66c5bde4cb62b3100e855baeace0cd2320/bigquery/src/http/job/get_query_ results.rs#L42

yoshidan avatar May 16 '25 02:05 yoshidan