-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dataset not found in pre-populated database file #207
Comments
The script I used to insert data is this one. # insert_dataset.py
from google.cloud import bigquery
from google.api_core.client_options import ClientOptions
your_project = "test"
your_dataset = "dataset1"
your_table = "table_a"
your_endpoint = "http://0.0.0.0:9050"
dataset_id = f"{your_project}.{your_dataset}"
data = [
{
"birthday": "2007-02-01",
"created_at": "2022-01-02 18:00:00",
"id": "3",
"name": "forbar",
"skillNum": "5",
"structarr": [
{
"key": "profile",
"value": "{\"age\": 15}"
}
]
}
]
if __name__ == '__main__':
options = ClientOptions(api_endpoint=your_endpoint)
client = bigquery.Client(project=your_project, client_options=options)
dataset_ref = client.get_dataset(your_dataset)
table_ref = dataset_ref.table(your_table)
table = client.get_table(table_ref)
try:
print('Inserting data ...')
client.insert_rows(table, data)
print('Data inserted successfully.')
except ValueError:
print("Error: Invalid value")
except Exception as e:
print(f"An error occurred: {str(e)}") |
I seeing the same behavior |
Same for me |
Thank you for reporting. I am currently investigating this issue and would like to share my findings so far. Although more research is needed for a resolution, here's what I've understood to this point: The main concern seems to come from the inability to retrieve datasets using the API. Initially, I examined the API responsible for fetching datasets. I discovered that at this point in the code, the project information is retrieved from When the application is launched with the The project information in I've compared the projects table under two different conditions: with and without the When the application is started with the
without
Here, the same project "proj" shows an empty array for both datasetIDs and jobIDs. From these observations, I suspect that at some point during the application's startup process, the metadata of the project, specifically the datasets information, is being overwritten. (maybe somewhere in loader.go.) This leads to the absence of datasets information when the application is started without the My investigation steps were as follows:
|
This comment was marked as resolved.
This comment was marked as resolved.
Hey! Is there any progress on this issue? Without it it's basically impossible to persist data. Or maybe there is some workaround? |
I do want to preface that I have not looked into the issue here much at all (and could be missing parts), but...
If you have the willingness patch and build it yourself (and possibly if your usage of And if it proves interesting/useful, below is some more information about the issue, at least from what I saw as I went poking around. It looks like the issue is related to the In other words, if you run the emulator with something like The specific Server.Load call looks to be here and the part that clobbers looks to be here via the Repository.UpdateProject call as while the project does exists, the project argument to the function will not match what is stored, at least if you are using a database file and have made changes externally to |
There is an open PR around that for a quite while now. #269 |
Problem statement
I run bigquery-emulator with a yaml schema and a database file; insert some data and exit.
When re-running the emulator again; dataset and tables doesn't appear on queries.
If I open them in sqlite browser dataset1 exits base64 encoded.
Steps to reproduce
(here I'm not using the schema in the arguments)
docker stop bq-emulator docker run \ --name=bq-emulator \ --rm -v $PWD:/work \ -p 9050:9050 \ ghcr.io/goccy/bigquery-emulator:0.4.2 \ --project=test \ --database=/work/test.db [bigquery-emulator] REST server listening at 0.0.0.0:9050 [bigquery-emulator] gRPC server listening at 0.0.0.0:9060
The data is there;
However, if I try to insert to data it tells me that dataset1 is not found.
If I try to list it with curl the same warning.
The same request worked previously!
Any suggestions or ideas ?
The text was updated successfully, but these errors were encountered: