Code Monkey home page Code Monkey logo

Comments (5)

Matts966 avatar Matts966 commented on July 28, 2024

We can remove cycles by introducing some total order to the cycle like the dead lock prevention in DB.
We are now planning to implement an option to use file names order for the use and another option to remove all the edges in the cycle.

from alphasql.

Matts966 avatar Matts966 commented on July 28, 2024

Automatically removing cycles can ignore problems of SQL files.
It is simpler to make nodes depend only on create table statements, and if parallel execution is undesirable, write a script file to execute sequentially.

When the above simple rule implemented, we can ignore the possibility of cycles (in anyway, the type checking fails with cycle even now)

  1. create table with unique name
  2. only use existing resources

The cycle free property of this algorithm is proved by simple induction even for functions and variables.

When modifying existing scripts, we should be cautious about cycles, but dag command teaches us when it happens.

from alphasql.

Matts966 avatar Matts966 commented on July 28, 2024

Also, we can always remove cycles by refactoring SQL files to separate depended resources as a new file because all the resources can be generated by another SQL.

This can be viewed as an example of DIP (dependency inversion principle).

from alphasql.

Matts966 avatar Matts966 commented on July 28, 2024

From v0.6.0, we only resolve dependencies between table references and create table statements.

from alphasql.

Matts966 avatar Matts966 commented on July 28, 2024

Making dependency of INSERT on CREATE, UPDATE on INSERT, and other DMLs on UPDATE for the preprocessing context is a little bit complex, and the order of dependency is not always reasonable. Also, coding rules to prevent cycles will be more complex than the current resolution algorithm.

We can express arbitrary dependencies as written in #5 by using dummy tables.

from alphasql.

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.