Skip to content
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

Support Table project #56

Open
josevalim opened this issue Aug 2, 2023 · 1 comment
Open

Support Table project #56

josevalim opened this issue Aug 2, 2023 · 1 comment

Comments

@josevalim
Copy link
Contributor

josevalim commented Aug 2, 2023

Hi @djm!

We have a project called Table which provides unified access to tabular data. Maybe it makes sense to support it on TableRex.quick_render!? It is a very tiny project, because it is only meant to act as a protocol. If you support it, you will be able to plot database results, Explorer data frames, Benchee results, and more out of the box.

The only potential conflict is that you assign two different meanings for lists. You always treat lists of enumerables as rows, but Table supports only lists of keyword lists or lists of maps. At the same time, TableRex will print both lists of keyword lists and lists of maps as rows of tuples, which I am not sure it is desired. Table will instead consider the keys as column names.

Therefore you can solve this in three ways, depending on which levels of compatibility you want to keep:

  1. Continue rendering lists of maps/keywords as is. This means as soon as you see a list, you keep the current implementation instead of calling Table.to_rows:

    def quick_render!([head | _] = list) do
      # current implementation
    
  2. Keep the current implementation only for lists of lists (this means lists of keywords still show tuples as rows but that's understandable) but maps will be printed using keys as columns and values as rows:

    def quick_render!([head | _] = list) when is_list(head) do
      # current implementation
    
  3. Change the behaviour for both lists of keywods/maps:

    def quick_render!([head | _] = list) when is_list(head) and not is_tuple(hd(head)) do
      # current implementation
    

Let me know what you think :)

@djm
Copy link
Owner

djm commented Aug 2, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants