AltimateAI / AltimateAI/vscode-dbt-power-user

Generate model "button" not working when using dbt-athena adapter (CatalogId and DatabaseName are None)

Aperta
#628 5 commenti 1 reazione 0 assegnatari Vedi su GitHub
bug
Lingua principale
JavaScript
Stelle
585
Fork
121
Merge medio
5g 39m
PR unite (30g)
4

Descrizione

### Expected behavior

When clicking "Generate model" from source, the model is properly generated:

![image](https://github.com/AltimateAI/vscode-dbt-power-user/assets/47462792/02852a8f-43a1-4fcf-bca1-d80a06ad70ed)

### Actual behavior

Clicking generate model generates two error messages:

```bash
Traceback (most recent call last):
File "/home/vscode/.vscode-server/extensions/innoverio.vscode-dbt-power-user-0.20.0/dist/node_python_bridge.py", line 104, in
value = eval(_compile(data['code'], '', 'eval'), _locals) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1, in File "/home/vscode/.vscode-server/extensions/innoverio.vscode-dbt-power-user-0.20.0/dist/dbt_integration.py", line 501, in get_columns_in_relation
return self.adapter.get_columns_in_relation(relation)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vscode/workspace/.venv/lib/python3.11/site-packages/dbt/adapters/athena/impl.py", line 885, in get_columns_in_relation
table = glue_client.get_table(CatalogId=catalog_id, DatabaseName=relation.schema, Name=relation.identifier)[
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
```

and following

```bash
An error occured while trying to generate the model Parameter validation failed:
Invalid type for parameter CatalogId, value: None, type: , valid types:
Invalid type for parameter DatabaseName, value: None, type: , valid types:
```

Other buttons work fine (e.g. Run model, build model etc...)

### Steps To Reproduce

The dbt project is inside a folder in the root of the repo. E.g.

```
my_big_project/
other_stuff...
dbt/
models/
dbt_project.yml
...
```

I'm using vscode devcontainer and the following configurations:

dockerfile

```Dockerfile
FROM python:3.11-slim-bookworm

ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=${USER_UID}
ARG HOME=/home/${USERNAME}
ENV PATH=${HOME}/.local/bin:$PATH

RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& apt-get update -y \
&& apt-get upgrade -y \
&& apt-get install -y curl wget zsh git ca-certificates gnupg sudo \
# [Optional] Add sudo support. Omit if you don't need to install software after connecting
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} \
&& chmod 0440 /etc/sudoers.d/${USERNAME}

# Insall node and npm as it's needed for SQLTools
ARG NODE_MAJOR=18
RUN mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list \
&& apt-get install --no-install-recommends -y nodejs npm

RUN wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq &&\
chmod +x /usr/bin/yq

# Install poetry
ARG POETRY_VERSION="none"
RUN if [ "${POETRY_VERSION}" != "none" ]; then echo "Installing poetry" \
&& curl -sSL https://install.python-poetry.org | POETRY_VERSION=${POETRY_VERSION} python3 - ; \
fi

USER ${USERNAME}
```

My profiles.yml

```yml
myproject:
target: dev
outputs:
dev:
database: awsdatacatalog
aws_profile_name: myprofile
region_name: eu-west-1
s3_data_dir: s3://mybucket
s3_staging_dir: s3://aws-athena-query-results-xxxxx
schema: my_schema
threads: 4
type: athena
```

The rest is pretty much standard dbt project: I have a schema on AWS athena with some tables, and when I clicking "generate model" in the `sources.yml` file, it behaves as described.

### Log output/Screenshots

This is as much as I have in term of logs, it seems like the "output" tab in vscode doesn't have the logs from this extension.

![image](https://github.com/AltimateAI/vscode-dbt-power-user/assets/47462792/8126a29d-5ce3-4295-b988-52b63c326656)

### Operating System

Debian GNU/Linux 12 (bookworm)

### dbt version

1.6.4

### dbt Adapter

dbt-athena

### dbt Power User version

0.20.1

### Are you willing to submit PR?

- [X] Yes I am willing to submit a PR!

I would like to help and contribute if you can help me in pinpointing what could be causing this specific issue.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.