-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add functions equivalent to create_rows and create_rows_json that create a table for you using a load job #4553
Comments
@tswast any ideas on this one? |
I believe this is a backend issue with the streaming buffer taking a little time to get created beyond that of the table create call. According to https://stackoverflow.com/a/41446002/101923
This may be due to the fact that the streaming buffer has a cache of table information, which gets refreshed every 60 seconds. Closing since this isn't a client library issue. |
@tswast is the recommend alternative to just create tables ahead of time? |
If you know what rows you want to insert at table creation time, I recommend using the Client.load_table_from_file() method to insert the rows using a StringIO object as the file. For example:
|
Reopening because we could probably help out in this case by having something like |
If we do implement such a method, we should probably encode as Avro, since Avro is supposedly 10x faster to load than JSON or CSV. |
So I dropped the immediate push after create step from this to see if the "error" would replicate after a wait like suggested. I created the table (and verified that it was indeed created), and set a timer to sleep for 4 minutes. After which I sent the request and waited another 4 minutes before checking the table; there was a row in the streaming buffer - so it seems like you are correct in that this is not a bug. This would be a nice feature though as I sometimes have to programmatically create tables based on large JSON files with things like user lists on the fly, but now that I know I have to wait I can simply add a delay in the code. |
It's a little clunky but if you use |
@tswast Does this issue need to remain open? |
Yeah, we haven't completed this feature request. It is on @alixhami's list of OKRs to tackle. |
Actually, @alixhami implemented load_table_from_dataframe() which covers a similar use case, but uploads a Pandas DataFrame rather than JSON or JSON-like rows. |
@tswast Should this item remain open here, or are we tracking it somewhere in a feature backlog? |
@tseaver We can add to a feature request backlog. |
Posting for better visibility - when this is implemented, use it instead of |
It worked fine for me, thanks :) |
This will not add rows:
This will add exactly one row:
The text was updated successfully, but these errors were encountered: