Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

427 allows passing schema name in create_view() and create_materialized_view() #597

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

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.

None yet

3 participants