Skip to content

Conversation

nestguti
Copy link

Update create_view() and create_materialized_view() functions to pass schema name for Postgres DB

add test unit test_views_schema.py and update test_views.py

@seachad
Copy link

seachad commented May 25, 2022

Hi, reviewing the code I wonder if DropView has support for schema as CreateView. Maybe I'm wrong but it appears it doesn't.

@nestguti
Copy link
Author

nestguti commented May 25, 2022

Hi, reviewing the code I wonder if DropView has support for schema as CreateView. Maybe I'm wrong but it appears it doesn't.

Yes, It does:

@compiler.compiles(DropView)
def compile_drop_materialized_view(element, compiler, **kw):
    return 'DROP {}VIEW IF EXISTS {} {}'.format(
        'MATERIALIZED ' if element.materialized else '',
        compiler.dialect.identifier_preparer.format_table(element.table, use_schema=True),
        'CASCADE' if element.cascade else ''
    )

@kurtmckee
Copy link
Collaborator

@nestguti thanks for pointing that out. I edited your comment so it would show up as highlighted Python. In the future you can use this syntax to accomplish the same thing:

```python
for code in example:
    print("Use three backticks and the name of the language!")
    print("Then end the code block with another three backticks!")
```

@nestguti
Copy link
Author

@nestguti thanks for pointing that out. I edited your comment so it would show up as highlighted Python. In the future you can use this syntax to accomplish the same thing:

```python
for code in example:
    print("Use three backticks and the name of the language!")
    print("Then end the code block with another three backticks!")

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants