Closed Sergey778 closed 7 years ago
Did you create that YAML by hand or with dbtoyaml
(in master)? If you look at the test tests/dbobject/test_matview.py MatViewToSqlTestCase test_create_view()
you'll notice that the materialized view has an additional attribute: depends_on
. This is part of the dependency tracking changes implemented in master (but not yet fully documented). If I add the lines:
depends_on:
- table test
after the definition
line, yamltodb
creates the table first.
This example I created by hands, but in my main project dbtoyaml generated script without depends_on
attribute.
Did you use the dbtoyaml
from master
in your main project? If you were previously using an installed version, please double check (if you run dbtoyaml --version
, it should show 0.8.dev0, whereas the one installed via pip would show 0.7.3 or similar). In any case, after running the corrected YAML file into a database, if I run dbtoyaml
on it, both Python 2 and 3 show the depends_on
attribute:
Python 2:
materialized view concept_subsumption:
definition: " SELECT test.name\n FROM test;"
depends_on:
- table test
Python 3:
materialized view concept_subsumption:
definition: |2-
SELECT test.name
FROM test;
depends_on:
- table test
Oh, I don't know how this happened but I have installed old dbtoyaml and new yamltodb. So, yes, with master there is no problem. Sorry and thanks for help :)
Problem
Pyrseas creates a materialized view before the tables on which it depends when using yamltodb.
Reproducing
Load following script in db using yamltodb:
Problem exists on master-branch.