GithubHelp home page GithubHelp logo

room-with-a-view's People

Contributors

elstonayx avatar lydiagu avatar marcua avatar thisisdhaas avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

elstonayx

room-with-a-view's Issues

Some details

Problems

  • Because we hard-code view names, we can't have multiple environments (e.g., dev/production)
  • Because there's no notion of view dependencies, when we change a view's schema, we have to manually drop views and recreate the dependency chain.
  • Our view materializer similarly runs into these issues.

Solution: Room with a View, an open source package for managing (Redshift) views

  • Any view/function/anything you can write in SQL can be preceded with a SQL comment of the form --export thing_name.
  • If you want to use an exported thing in another file, you can say --from path/to/some/file.sql import exported_name

Example of how the package can get used

  • room_with_a_view.py --environment staging --connection conection1 sync viewname -> creates the necessary views and functions that viewname depends on (including any other view that would have been dropped due to the cascading drop of the view to support schema changes)
  • Alternative sync examples: room_with_a_view.py --environment staging --connection conection1 sync_all or room_with_a_view.py --environment staging --connection conection1 sync_file filename.sql
  • room_with_a_view.py --environment staging --connection conection1 [drop viewname|drop_all|drop_file filename.sql]
  • room_with_a_view.py --environment staging --connection conection1 materialize viewname would create viewname
  • room_with_a_view.py --environment staging --connection conection1 list would list all known exported symbols and the comment around them

Other things

  • We might have to say export function or export view so we know how to drop it (DROP FUNCTION vs DROP VIEW)

Example settings.yaml file

connections:
  connection1:
    hostname: hostname
    port: 5432
environments:
  production:
    postfix: ""
  staging:
    postfix: _staging

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.