Giter Site home page Giter Site logo

Comments (21)

0x777 avatar 0x777 commented on April 19, 2024 14

@eads as a workaround you can create a regular view as follows:

create view somename as select * from materialized_view;

You can now access data from the view somename which in turn fetches data from the materialized view.

from graphql-engine.

revskill10 avatar revskill10 commented on April 19, 2024 5

@amesas Could hasura automatically handle Refreshing view for us ?

from graphql-engine.

mterron avatar mterron commented on April 19, 2024

pg_class probably have what you are looking for:

SELECT n.nspname as "Schema",
  c.relname as "Name",
  CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'm' THEN 'materialized view' WHEN 'f' THEN 'foreign table' WHEN 'p' THEN 'table' END as "Type",
  pg_catalog.pg_get_userbyid(c.relowner) as "Owner"
FROM pg_catalog.pg_class c
     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind IN ('r','p','f','v','m')
      AND n.nspname <> 'pg_catalog'
      AND n.nspname <> 'information_schema'
      AND n.nspname !~ '^pg_toast'
  AND pg_catalog.pg_table_is_visible(c.oid)
ORDER BY 1,2;

from graphql-engine.

eads avatar eads commented on April 19, 2024

👍 to this PR. Materialized views are a powerful tool for data analysis and it's a bummer I can't access them from Hasura currently.

from graphql-engine.

revskill10 avatar revskill10 commented on April 19, 2024

Does materialized view automatically get updated when we mutate the related tables ?

from graphql-engine.

amesas avatar amesas commented on April 19, 2024

Nope by default.

You have to call REFRESH VIEW
https://www.postgresql.org/docs/11/static/sql-refreshmaterializedview.html

We use triggers with REFRESH CONCURRENTLY in some scenarios and a "CRON" in others.

from graphql-engine.

pyankoff avatar pyankoff commented on April 19, 2024

@0x777 Thanks for the hack!
Would be great to have a proper solution though

from graphql-engine.

sfcgeorge avatar sfcgeorge commented on April 19, 2024

It's not just showing untracked that doesn't work, even if you create the materialized view within Hasura SQL tab and click "Track" it doesn't show up. So I'll use the view wrapper trick.

from graphql-engine.

karibertils avatar karibertils commented on April 19, 2024

+1 Would love to see this implemented

@0x777 hack is useful until then 😄

from graphql-engine.

nagautier avatar nagautier commented on April 19, 2024

👍 Hack works fine, but it would be cool to have materialized views discovered :).

from graphql-engine.

pksunkara avatar pksunkara commented on April 19, 2024

Can we get this before v1?

from graphql-engine.

ron-johnson avatar ron-johnson commented on April 19, 2024

👍 We would like to see this functionality also

from graphql-engine.

vitorbertulucci avatar vitorbertulucci commented on April 19, 2024

It will be really great!!

from graphql-engine.

poupryc avatar poupryc commented on April 19, 2024

Could hasura automatically handle Refreshing view for us ?

It would be absolutely fantastic, I use a cron script for that but centralizing everything in Hasura would be a very good addition for v1.

from graphql-engine.

thesems avatar thesems commented on April 19, 2024

+1 would be good to have

from graphql-engine.

garlou avatar garlou commented on April 19, 2024

+1

from graphql-engine.

GavinRay97 avatar GavinRay97 commented on April 19, 2024

+1

from graphql-engine.

bradjabel avatar bradjabel commented on April 19, 2024

+1

from graphql-engine.

emailnjv avatar emailnjv commented on April 19, 2024

+1

from graphql-engine.

sounden avatar sounden commented on April 19, 2024

+1

from graphql-engine.

ryanberckmans avatar ryanberckmans commented on April 19, 2024

This is fixed in v1.2.2 (or maybe earlier, I upgraded from 1.1)

from graphql-engine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.