-
Notifications
You must be signed in to change notification settings - Fork 59
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
Override check schema exists #452
Changes from all commits
8f92274
29e5a5c
34fd237
8cf25a9
b86a826
dc98d12
7bf1978
0958f28
c69e651
bce3e88
451c60d
4353a38
b5494a6
4295477
d408c06
98ed151
bd4aa2f
2a35c33
a4848d1
c4e030b
eeaa4bc
b43b24a
8e1e028
99ef2f0
5c16f0c
259ec22
7746d0c
579c21a
08f3aa2
1385563
b2de60a
fd7aaf6
de78fcc
a988555
68f2c73
c3acee4
f25c8b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
kind: Features | ||
time: 2023-04-07T10:47:23.105369-07:00 | ||
custom: | ||
Author: jiezhen-chen | ||
Issue: 555 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,9 +142,6 @@ def _connection_keys(self): | |
"schema", | ||
"sslmode", | ||
"region", | ||
"sslmode", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason to remove these? Is it related to this specific change? |
||
"region", | ||
"iam_profile", | ||
"autocreate", | ||
"db_groups", | ||
"ra3_node", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from dataclasses import dataclass | ||
from typing import Optional, Set, Any, Dict, Type | ||
from typing import Optional, Set, Any, Dict, Type, List | ||
from collections import namedtuple | ||
from dbt.adapters.base import PythonJobHelper | ||
from dbt.adapters.base.impl import AdapterConfig, ConstraintSupport | ||
|
@@ -115,6 +115,21 @@ def valid_incremental_strategies(self): | |
def timestamp_add_sql(self, add_to: str, number: int = 1, interval: str = "hour") -> str: | ||
return f"{add_to} + interval '{number} {interval}'" | ||
|
||
def _get_cursor(self): | ||
return self.connections.get_thread_connection().handle.cursor() | ||
|
||
def list_schemas(self, database: str, schema: Optional[str] = None) -> List[str]: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would update the associated macro to call this, otherwise any other macro that is using the associated macro would still use the postgres macro, hence pg_ tables. |
||
cursor = self._get_cursor() | ||
results = [] | ||
for s in cursor.get_schemas(catalog=database, schema_pattern=schema): | ||
results.append(s[0]) | ||
return results | ||
|
||
@available | ||
def check_schema_exists(self, database: str, schema: str) -> bool: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as on |
||
results = self.list_schemas(database=database, schema=schema) | ||
return len(results) > 0 | ||
|
||
def _link_cached_database_relations(self, schemas: Set[str]): | ||
""" | ||
:param schemas: The set of schemas that should have links added. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is missing a description that identifies the change.