-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from bachng2017/drop_database
Drop database
- Loading branch information
Showing
4 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from dataclasses import dataclass | ||
|
||
from dbt.adapters.base.relation import BaseRelation, Policy | ||
from dbt.contracts.relation import ComponentName | ||
|
||
|
||
@dataclass | ||
class MindsdbQuotePolicy(Policy): | ||
database: bool = False | ||
schema: bool = False | ||
identifier: bool = False | ||
|
||
|
||
@dataclass(frozen=True, eq=False, repr=False) | ||
class MindsdbRelation(BaseRelation): | ||
quote_policy: MindsdbQuotePolicy = MindsdbQuotePolicy() | ||
|
||
# Overridden as Mindsdb converts relation identifiers to lowercase | ||
def _is_exactish_match(self, field: ComponentName, value: str) -> bool: | ||
return self.path.get_lowered_part(field) == value.lower() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% macro mindsdb__create_schema(relation) -%} | ||
{%- call statement('create_schema') -%} | ||
SELECT 1 | ||
{% endcall %} | ||
{% endmacro %} | ||
|
||
|
||
{% macro mindsdb__drop_schema(relation) -%} | ||
{%- call statement('drop_schema') -%} | ||
drop database if exists {{ relation.without_identifier() }} | ||
{% endcall %} | ||
{% endmacro %} |