zatae
I am using google_api to query a BigQuery dataset but I find it very difficult to parse data (TableRow/TableFieldSchema) contained in response.
It looks like there is no built-in tool to convert this to simply convert it to a Map or anything else. I found this solution that works pretty well but it’s really weird to me that there is no simpler way to do it ?
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted”
Version...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #blog-post
- #ai
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
adammokan
Yeah, what you are bumping into can be a chore with the semi-official library - but once you’ve used it for a while, its not terrible.
LogFlare has a solution that is similar to one I use in my production systems for turning that output into a list of maps with the correct field names and stuff. That is here. Basically they are pulling the schema data from the response and coercing the rows into the correct shapes, types, snake casing attribute names, etc.
Also worth looking at the BQ related stuff in the LiveBook side of the community. The
req/req_bigquerylibrary. That just hits the REST API the same as the google client you point to (which uses Tesla under the hood). Not saying to use that for your project, but they take an another approach to handle that output using theTable.Readerprotocol as is becoming common for Livebook-related efforts. There are YouTube videos showing how to use this for grabbing data in a LiveBook.As to some of the reasons why the main library doesn’t do this for you is that he official google cloud hex packages (that I am aware) of are built by some sort of code generator based on API specs. I think it is just a person or two at Google that sponsor those efforts, so I understand why it is as automated as possible. The negative of this is they lack any sort of normal polish or feel like Elixir libraries. As someone who has written a ton of google cloud-related elixir code over the years, I’ve learned to have the Google REST API docs open while trying to decipher these libraries. Much easier than following the long namespaces around in hexdocs. Last point is that all of the google libraries are just hitting these same REST API endpoints (no matter the language).
Also worth just hitting up hex.pm and tossing BigQuery in the search. I know there are a few efforts in various states over the years. Most people I know just end up building a module to clean up the output and reuse it in many projects.
If I have some free cycles next week, I try to revisit this thread out and toss a gist of my variation on this if needed.
adammokan
@zatae After looking more at my earlier response, I realized that the LogFlare stuff I linked to was more related to writing to BQ.
My solution to handling the output from BQ is generally based off the same StackOverflow link you posted.
FWIW, here is a gist of a single module I extracted from some production systems in my world. I did just toss in the handling for “JSON” data types, but didn’t test it. Only requirement outside of the BQ library is
jason.Not suggesting this is any better than the StackOverflow solution, but has a few opinionated things going on to meet my needs.
zatae
Thank you very much for all the useful information.
I have the same feeling but it’s true that once you are confortable with reading in-code documentation and Google APIs docs together it feels pretty easy to use their API wrapper.
I will give it a try ! Thanks.
samwiseZ
Thank you for your service. This gist has saved me a significant amount of time