Metadata-Version: 2.1
Name: dbt-sas
Version: 1.3.0a3
Summary: dbt (data build tool) adapter for SAS
Home-page: https://github.com/DLBD-Department/dbt-sas
Author: Alkemy Spa
Author-email: DLBDDepartment@nunatac.it
License: Apache License 2.0
Project-URL: Bug Tracker, https://github.com/DLBD-Department/dbt-sas/issues
Project-URL: Source Code, https://github.com/DLBD-Department/dbt-sas
Keywords: dbt,sas
Platform: any
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Provides-Extra: test

# SAS DBT adapter

The dbt-sas package allows dbt to connect to SAS.

## Installation

```
pip install dbt-sas
```

## Configurations

Basic `profile.yml` for connecting to SAS:

```yml
sas-test:
  outputs:
    dev:
      type: sas
      host: SAS host
      port: 8591
      database: sas (keep 'sas', don't change)
      schema: default libray name
      user: SAS username
      password: SAS password
      autoexec: optional local path of autoexec.sas file
      lib_base_path: optional path (on the SAS server) for new libraries
      threads: 1
      fail_on_warnings: False
      lib_name_strict_mode: False
  target: dev

```
| Key                    | Required | Description                                          |
| ---------------------- | -------- | ---------------------------------------------------- |
| `type`                 | Yes      | The specific adapter to use (`sas`)                  |
| `host`                 | Yes      | SAS server hostname                                  |
| `port`                 | Yes      | SAS server port                                      |
| `database`             | Yes      | `sas`, don't change                                  | 
| `schema`               | Yes      | Default SAS libname                                  |
| `username`             | Yes      | The username to use to connect to the server         |
| `password`             | Yes      | The password to use for authenticating to the server |
| `handler`              | Yes      | SAS handler `ws` (default) or `saspy`                |
| `autoexec`             | No       | Local path of autoexec.sas file                      |
| `lib_base_path`        | No       | Base path on the SAS server for new libraries        |
| `fail_on_warnings`     | No       | Raise and error if it encounters a warning           |
| `lib_name_strict_mode` | No       | Enable strict libname/identifier check               |

## Features

| Key      | Supported | Description                                          | 
| -------- | -------- | ---------------------------------------------------- |
| [Tests](https://docs.getdbt.com/docs/build/tests) | Yes |  |
| [Load seed files](https://docs.getdbt.com/docs/build/seeds) | Yes |  |
| [View Materialization](https://docs.getdbt.com/docs/build/materializations#view) | Yes |  |
| [Table Materialization](https://docs.getdbt.com/docs/build/materializations#table) | Yes |  |
| [Ephemeral Materialization](https://docs.getdbt.com/docs/build/materializations#ephemeral) | Partial |  |
| [Incremental Materialization](https://docs.getdbt.com/docs/build/materializations#incremental) | No |  |
| [Snapshots](https://docs.getdbt.com/docs/build/snapshots) | No |  |
| [Grants](https://docs.getdbt.com/reference/resource-configs/grants) | No |  |

## Usage

- Create dbt project, choose sas database and set up connection
```console    
$ dbt init <project_name>
```

## Testing

- Install dev requirements
```console
$ pip install -r dev_requirements.txt
```
- Run pytest
```console    
$ python -m pytest tests/
```

## Logging

```console
export DBT_SAS_LOG='file.log'
export DBT_SAS_FAMILY='sas,sql'
export DBT_SAS_FAMILY='sas,sql,original_sql'
```

## TODO

```console
$ make venv
$ source ./bin/activate
$ python
Python 3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import saspy
>>> sas=saspy.SASsession(java='/usr/bin/java', iomhost='***', iomport=8591, omruser='***', omrpw='***')
Using SAS Config named: default
SAS Connection established. Subprocess id is 1139816

>>>
```

## Licence

Apache License, Version 2.0

## Links

* [SASpy](https://github.com/sassoftware/saspy)
* [SQL Procedure](https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/sqlproc/n0w2pkrm208upln11i9r4ogwyvow.htm)
