Skip to content

Commit 1bd64e4

Browse files
authored
Merge pull request #51 from MatthewPocock/main
compatiblity for 1.5.0
2 parents af6dd91 + ed6cda0 commit 1bd64e4

File tree

8 files changed

+31
-22
lines changed

8 files changed

+31
-22
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
build:
88
strategy:
99
matrix:
10-
python_version: ["3.8", "3.9", "3.10"]
10+
python_version: ["3.8", "3.9", "3.10", "3.11"]
1111

1212
runs-on: ubuntu-latest
1313

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN apt-get update && apt-get -y install git python3 python3-pip python3-venv sq
88
WORKDIR /opt/dbt-sqlite
99

1010
RUN python3 -m pip install --upgrade pip \
11-
&& python3 -m pip install pytest pytest-dotenv dbt-core~=1.4.0 dbt-tests-adapter~=1.4.0
11+
&& python3 -m pip install pytest pytest-dotenv dbt-core~=1.5.0 dbt-tests-adapter~=1.5.0
1212

1313
RUN wget -q https://github.com/nalgeon/sqlean/releases/download/0.15.2/crypto.so
1414
RUN wget -q https://github.com/nalgeon/sqlean/releases/download/0.15.2/math.so

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Use the right version. Starting with the release of dbt-core 1.0.0,
3434
versions of dbt-sqlite are aligned to the same major+minor
3535
[version](https://semver.org/) of dbt-core.
3636

37+
- versions 1.5.x of this adapter work with dbt-core 1.5.x
3738
- versions 1.4.x of this adapter work with dbt-core 1.4.x
3839
- versions 1.3.x of this adapter work with dbt-core 1.3.x
3940
- versions 1.2.x of this adapter work with dbt-core 1.2.x

dbt/adapters/sqlite/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = '1.4.0'
1+
version = '1.5.0'

dbt/adapters/sqlite/connections.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import glob
55
import os.path
66
import sqlite3
7+
from socket import gethostname
78
from typing import Optional, Tuple, Any, Dict, List
89

910

@@ -37,7 +38,7 @@ def unique_field(self):
3738
Hashed and included in anonymous telemetry to track adapter adoption.
3839
Pick a field that can uniquely identify one team/organization building with this adapter
3940
"""
40-
return self.host
41+
return gethostname()
4142

4243
def _connection_keys(self):
4344
""" Keys to show when debugging """
@@ -73,7 +74,7 @@ def open(cls, connection: Connection):
7374

7475
for ext_path in credentials.extensions:
7576
handle.load_extension(ext_path)
76-
77+
7778
cursor = handle.cursor()
7879

7980
for schema in set(schemas_and_paths.keys()) - set(['main']):

dbt/include/sqlite/macros/adapters.sql

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,22 @@
7979
{% endmacro %}
8080

8181
{% macro sqlite__create_table_as(temporary, relation, sql) -%}
82-
create {% if temporary -%}
82+
{% set contract_config = config.get('contract') %}
83+
{% if contract_config.enforced %}
84+
{{exceptions.warn("Model contracts cannot be enforced by sqlite!")}}
85+
{% endif %}
86+
create {% if temporary -%}
8387
temporary
84-
{%- endif %} table {{ relation }}
85-
as
88+
{%- endif %} table {{ relation }}
89+
as
8690
{{ sql }}
8791
{% endmacro %}
8892

8993
{% macro sqlite__create_view_as(relation, sql, auto_begin=False) -%}
94+
{% set contract_config = config.get('contract') %}
95+
{% if contract_config.enforced %}
96+
{{exceptions.warn("Model contracts cannot be enforced by sqlite!")}}
97+
{% endif %}
9098
create view {{ relation }} as
9199
{{ sql }};
92100
{%- endmacro %}
@@ -96,15 +104,6 @@
96104
{# see SQLiteAdapter.rename_relation() #}
97105
{% endmacro %}
98106

99-
{% macro sqlite__snapshot_get_time() -%}
100-
datetime()
101-
{%- endmacro %}
102-
103-
{% macro sqlite__snapshot_string_as_time(timestamp) -%}
104-
{# just return the string; SQLite doesn't have a timestamp data type per se #}
105-
{{ return("'" + timestamp|string + "'") }}
106-
{%- endmacro %}
107-
108107
{#
109108
the only allowable schema for temporary tables in SQLite is 'temp', so set
110109
that here when making the relation and everything else should Just Work
@@ -116,7 +115,3 @@ that here when making the relation and everything else should Just Work
116115

117116
{% do return(tmp_relation) %}
118117
{% endmacro %}
119-
120-
{% macro sqlite__current_timestamp() -%}
121-
datetime()
122-
{%- endmacro %}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{% macro sqlite__current_timestamp() -%}
2+
datetime()
3+
{%- endmacro %}
4+
5+
{% macro sqlite__snapshot_string_as_time(timestamp) -%}
6+
{# just return the string; SQLite doesn't have a timestamp data type per se #}
7+
{{ return("'" + timestamp|string + "'") }}
8+
{%- endmacro %}
9+
10+
{% macro sqlite__snapshot_get_time() -%}
11+
datetime()
12+
{%- endmacro %}

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def _get_plugin_version():
4646
]
4747
},
4848
install_requires=[
49-
"dbt-core>=1.4.0"
49+
"dbt-core~=1.5.0"
5050
],
5151
classifiers=[
5252
'Development Status :: 4 - Beta',

0 commit comments

Comments
 (0)