Comments (6)
It's difficult to investigate with this information, so please provide a repro code
from bigquery-emulator.
Closed due to no response
from bigquery-emulator.
Sorry for the late response, here is the example of SQL script. I just run the bigquery.dataset(datasetId).query(query)
query = MERGE testDataset.testTable
USING UNNEST([struct<orderUuid STRING, userId INTEGER> ('260e3d0e-0a29-40a2-02ab-111111110a19', 10)]) TempTable ON testTable .orderUuid = TempTable.orderUuid
WHEN NOT MATCHED THEN INSERT (orderUuid,userId) VALUES (TempTable.orderUuid, TempTable.userId)
WHEN MATCHED THEN UPDATE SET testTable.orderUuid = TempTable.orderUuid, testTable .userId = TempTable.userId;
I just run the above query
bigquery.dataset(datasetId).query(query)
from bigquery-emulator.
After renaming INTEGER to INT64 in the schema I'm getting the following error
MERGE expression is supported equal expression only
for the same script
from bigquery-emulator.
Hi @goccy any idea ?
Thanks
from bigquery-emulator.
here is code for reprodusing
const {BigQuery} = require('@google-cloud/bigquery');
const orderSchemaForEmulator = [
{name: 'orderUuid', type: 'STRING', mode: 'REQUIRED'},
{name: 'userId', type: 'INT64', mode: 'REQUIRED'},
];
const bigQueryConfig = {
projectId: 'test',
datasetId: 'testDataset',
orderTableId: 'testTable',
};
const bigquery = new BigQuery({projectId: bigQueryConfig.projectId, apiEndpoint: 'http://localhost:9050'});
const dataset = bigquery.dataset(bigQueryConfig.datasetId);
let query = MERGE ${bigQueryConfig.datasetId}.${bigQueryConfig.orderTableId}
;
query += USING UNNEST([struct<
;
query += orderUuid STRING, userId INT64> (
+
'260e3d0e-0a29-40a2-02ab-111111020a19', 10)]) TempTable ON testTable .orderUuid = TempTable.orderUuid
+
WHEN NOT MATCHED THEN INSERT (orderUuid,userId) VALUES (TempTable.orderUuid, TempTable.userId) WHEN MATCHED
+
THEN UPDATE SET testTable.orderUuid = TempTable.orderUuid, testTable .userId = TempTable.userId
;
/**
*
- @return {Promise}
*/
async function test() {
try {
await dataset.table(bigQueryConfig.orderTableId).delete();
} catch (error) {
console.log(Error: ${error.message}
);
}
await dataset.createTable(bigQueryConfig.orderTableId, {schema: orderSchemaForEmulator});
await dataset.query(query);
}
test();
node version - 16
emulator version is 0.2.10
from bigquery-emulator.
Related Issues (20)
- Cant parametrize FLOAT value in query HOT 9
- `Too many SQL variables` when inserting data HOT 2
- When names of tables start with same string, _TABLE_SUFFIX expansion may fail
- Using JobId (in Java) when querying, causes 'no such table' error to be returned
- Replace SQLite with DuckDB
- Unmarshal fails to a struct with time.Time type when using the cloud.google.com/go/bigquery library HOT 5
- Queries on TIMESTAMP columns are not handled correctly when no timezone is specified HOT 1
- failed to add query result to dynamic destination table (on a simple query) HOT 4
- How to install and run this project locally on my computer? HOT 6
- JSON_EXTRACT_SCALAR nor JSON_QUERY does not work as expected HOT 1
- Connection error when creating a dataset HOT 8
- Does the emulator work with Pandas GBQ? HOT 3
- Error when executing bq command from google-cloud-cli version 469.0.0
- Response from table update is incompatible with Google's Python SDK HOT 1
- Improve emulator performance for large projects HOT 7
- Failes to exec merge statement UPDATE
- Cannot create a view with a query that ends in semicolon
- Cannot materialize job results when table does not yet exist
- [Golang] Errors from zetasql parser HOT 3
- The BigQuery emulator doesn't support CREATE TABLE AS SELECT with column definition list HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bigquery-emulator.