Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/ci_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
### A CI workflow template that runs linting and python testing
### TODO: Modify as needed or as desired.

name: Test 'singer-sqlite'

on: [push]

jobs:
linting:

runs-on: ubuntu-latest
strategy:
matrix:
# Only lint using the primary version used for dev
python-version: [3.9]

steps:
- uses: actions/checkout@v2
- name: Set up Python '${{ matrix.python-version }}'
uses: actions/setup-python@v2
with:
python-version: '${{ matrix.python-version }}'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.1.12
- name: Install dependencies
run: |
poetry install
- name: Run lint command from tox.ini
run: |
poetry run tox -e lint

pytest:

runs-on: ubuntu-latest
env:
GITHUB_TOKEN: '${{secrets.GITHUB_TOKEN}} }}'
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
- name: Set up Python '${{ matrix.python-version }}'
uses: actions/setup-python@v2
with:
python-version: '${{ matrix.python-version }}'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.1.11
- name: Install dependencies
run: |
poetry install
- name: Test with pytest
run: |
poetry run pytest --capture=no
13 changes: 0 additions & 13 deletions .gitlab-ci.yml

This file was deleted.

2 changes: 1 addition & 1 deletion target_sqlite/sqlite_loader.py → bak/sqlite_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from sqlalchemy.schema import CreateSchema
from sqlalchemy import exc

from target_sqlite.utils.error import SchemaUpdateError
from singer_sqlite.utils.error import SchemaUpdateError


# Map sqlalchemy types to SQLite Types
Expand Down
6 changes: 3 additions & 3 deletions target_sqlite/target_sqlite.py → bak/target_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
from jsonschema import ValidationError, Draft4Validator, FormatChecker
from typing import Dict, List, Iterator

from target_sqlite.utils.singer_target_utils import (
from singer_sqlite.utils.singer_target_utils import (
flatten_record,
flatten_key,
generate_sqlalchemy_table,
)
from target_sqlite.sqlite_loader import SQLiteLoader
from singer_sqlite.sqlite_loader import SQLiteLoader


LOGGER = singer.get_logger()
Expand Down Expand Up @@ -350,7 +350,7 @@ def emit_state(self, state) -> None:
"""
if state is not None:
line = json.dumps(state)
LOGGER.debug('Emitting state {}'.format(line))
LOGGER.debug("Emitting state {}".format(line))
sys.stdout.write("{}\n".format(line))
sys.stdout.flush()

Expand Down
31 changes: 31 additions & 0 deletions bak/tests-bak/bak-conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import json
import pytest


class SilencedDict(dict):
def __repr__(self):
return "Dict[ ... sensitive_data ... ]"

def __str__(self):
return "Dict[ ... sensitive_data ... ]"


def pytest_addoption(parser):
parser.addoption("--config", help="Config file", required=True)


@pytest.fixture(scope="session")
def config(request):
config = SilencedDict()

config_file = request.config.getoption("--config")

if config_file:
with open(config_file) as input:
config.update(json.load(input))
else:
raise Exception("No config file provided")

config["timestamp_column"] = config.get("timestamp_column", "__loaded_at")

return config
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from sqlalchemy import MetaData, Table, Column, inspect
from sqlalchemy.types import TIMESTAMP, Float, String, BigInteger, Boolean

from target_sqlite.sqlite_loader import SQLiteLoader
from singer_sqlite.sqlite_loader import SQLiteLoader


@pytest.fixture(scope="class")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from jsonschema import ValidationError
from sqlalchemy import create_engine, inspect

from target_sqlite.target_sqlite import TargetSQLite
from target_sqlite.utils.error import SchemaUpdateError
from singer_sqlite import TargetSQLite, TapSQLite


def load_stream(filename):
Expand Down
File renamed without changes.
File renamed without changes.
Loading