Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fixed table_type for GOVERNED tables #661

Merged
merged 3 commits into from
May 28, 2024
Merged

fix: Fixed table_type for GOVERNED tables #661

merged 3 commits into from
May 28, 2024

Conversation

svdimchenko
Copy link
Contributor

Description

with following table

{'Name': 'test', 'DatabaseName': 'raw', 'Owner': 'hadoop', 'CreateTime': datetime.datetime(2022, 3, 8, 15, 49, 45, tzinfo=tzlocal()), 'UpdateTime': datetime.datetime(2022, 3, 8, 15, 49, 45, tzinfo=tzlocal()), 'LastAccessTime': datetime.datetime(1970, 1, 1, 1, 0, tzinfo=tzlocal()), 'Retention': 0, 'StorageDescriptor': {'Columns': [{'Name': 'brand', 'Type': 'string'}, {'Name': 'dt', 'Type': 'timestamp'}], 'Location': 's3://stage-dwh-transformed/brand_governed', 'InputFormat': 'org.apache.hadoop.hive.ql.io.parquet.MapredParquetInputFormat', 'OutputFormat': 'org.apache.hadoop.hive.ql.io.parquet.MapredParquetOutputFormat', 'Compressed': False, 'NumberOfBuckets': -1, 'SerdeInfo': {'SerializationLibrary': 'org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe', 'Parameters': {'serialization.format': '1'}}, 'BucketColumns': [], 'SortColumns': [], 'Parameters': {}, 'SkewedInfo': {'SkewedColumnNames': [], 'SkewedColumnValues': [], 'SkewedColumnValueLocationMaps': {}}, 'StoredAsSubDirectories': False}, 'PartitionKeys': [], 'TableType': 'GOVERNED', 'Parameters': {'transient_lastDdlTime': '1646750985', 'classification': 'parquet', 'table_type': 'LAKEFORMATION_GOVERNED'}, 'CreatedBy': 'xxx', 'IsRegisteredWithLakeFormation': False, 'CatalogId': 'xxx', 'IsMultiDialectView': False}

I've got an error on dbt docs generate:

Encountered an error while generating catalog: 'GOVERNED'

I've added GOVERNED table type and improved logging as well

Checklist

  • You followed contributing section
  • You kept your Pull Request small and focused on a single feature or bug fix.
  • You added unit testing when necessary
  • You added functional testing when necessary

nicor88
nicor88 previously approved these changes May 28, 2024
@nicor88 nicor88 dismissed their stale review May 28, 2024 12:40

Dismissing

@nicor88
Copy link
Contributor

nicor88 commented May 28, 2024

@svdimchenko have a look at the CI, there are some issues that needs to be addressed.

@svdimchenko
Copy link
Contributor Author

@svdimchenko have a look at the CI, there are some issues that needs to be addressed.

I see there is problem with https://github.com/dbt-athena/dbt-athena/blob/49896c21361ea74bb28aa1ee184c19f01d746776/tests/unit/test_adapter.py#L417-L417

do we have a use case when we need to create table without type ?

@nicor88
Copy link
Contributor

nicor88 commented May 28, 2024

As far as I remember there are specific scenarios (like external catalogs) where you can have tables without type, so yes, we should cover that scenarios.

@svdimchenko
Copy link
Contributor Author

As far as I remember there are specific scenarios (like external catalogs) where you can have tables without type, so yes, we should cover that scenarios.

I just see that this may conflict with get_table_type method. Which table_type should we get for such case ?

@nicor88
Copy link
Contributor

nicor88 commented May 28, 2024

I just see that this may conflict with get_table_type method. Which table_type should we get for such case ?

We can create UNKNOWN or something like that for case where the table type is None, alternatively we map to table even for None cases...
Alternatively, we can also change the unit tests to assert the value error on those cases ;) - I honestly don't recall the edge case.

@nicor88
Copy link
Contributor

nicor88 commented May 28, 2024

@svdimchenko final comment, #661 (comment) the rest looks good, thanks for the refactor.

@svdimchenko svdimchenko merged commit 8faa921 into main May 28, 2024
10 checks passed
@svdimchenko svdimchenko deleted the fix/table-type branch May 28, 2024 16:07
kodiakhq bot referenced this pull request in cloudquery/policies Jun 5, 2024
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [dbt-athena-community](https://github.com/dbt-athena/dbt-athena) | minor | `==1.7.2` -> `==1.8.2` |

---

### Release Notes

<details>
<summary>dbt-athena/dbt-athena (dbt-athena-community)</summary>

### [`v1.8.2`](https://github.com/dbt-athena/dbt-athena/releases/tag/v1.8.2)

[Compare Source](https://github.com/dbt-athena/dbt-athena/compare/v1.8.1...v1.8.2)

### What's Changed

#### Fixes

-   fix: Add wait_random_exponential for query retries by [@&#8203;svdimchenko](https://github.com/svdimchenko) in [https://github.com/dbt-athena/dbt-athena/pull/655](https://github.com/dbt-athena/dbt-athena/pull/655)
-   fix: Resolve error when cloning Python models ([#&#8203;645](https://github.com/dbt-athena/dbt-athena/issues/645)) by [@&#8203;jeancochrane](https://github.com/jeancochrane) in [https://github.com/dbt-athena/dbt-athena/pull/651](https://github.com/dbt-athena/dbt-athena/pull/651)
-   fix: Fixed table_type for GOVERNED tables by [@&#8203;svdimchenko](https://github.com/svdimchenko) in [https://github.com/dbt-athena/dbt-athena/pull/661](https://github.com/dbt-athena/dbt-athena/pull/661)

#### Features

-   feat: Set unique table suffix to allow parallel incremental executions by [@&#8203;pierrebzl](https://github.com/pierrebzl) in [https://github.com/dbt-athena/dbt-athena/pull/650](https://github.com/dbt-athena/dbt-athena/pull/650)
-   feat: Allow custom schema def for tmp tables generated by incremental by [@&#8203;pierrebzl](https://github.com/pierrebzl) in [https://github.com/dbt-athena/dbt-athena/pull/659](https://github.com/dbt-athena/dbt-athena/pull/659)
-   feat: Implement iceberg retry logic by [@&#8203;svdimchenko](https://github.com/svdimchenko) in [https://github.com/dbt-athena/dbt-athena/pull/657](https://github.com/dbt-athena/dbt-athena/pull/657)

#### Dependencies

-   chore: Update moto requirement from ~=5.0.7 to ~=5.0.8 by [@&#8203;dependabot](https://github.com/dependabot) in [https://github.com/dbt-athena/dbt-athena/pull/660](https://github.com/dbt-athena/dbt-athena/pull/660)
-   chore: Bumped version to 1.8.2 for release by [@&#8203;svdimchenko](https://github.com/svdimchenko) in [https://github.com/dbt-athena/dbt-athena/pull/663](https://github.com/dbt-athena/dbt-athena/pull/663)

#### Docs

-   docs: Cleanup README grammar, punctuation, and capitalisation by [@&#8203;dfsnow](https://github.com/dfsnow) in [https://github.com/dbt-athena/dbt-athena/pull/654](https://github.com/dbt-athena/dbt-athena/pull/654)

#### New Contributors

-   [@&#8203;jeancochrane](https://github.com/jeancochrane) made their first contribution in [https://github.com/dbt-athena/dbt-athena/pull/651](https://github.com/dbt-athena/dbt-athena/pull/651)
-   [@&#8203;pierrebzl](https://github.com/pierrebzl) made their first contribution in [https://github.com/dbt-athena/dbt-athena/pull/650](https://github.com/dbt-athena/dbt-athena/pull/650)

**Full Changelog**: dbt-labs/dbt-athena@v1.8.1...v1.8.2

### [`v1.8.1`](https://github.com/dbt-athena/dbt-athena/releases/tag/v1.8.1)

[Compare Source](https://github.com/dbt-athena/dbt-athena/compare/v1.7.2...v1.8.1)

#### What's Changed

##### Relevant notes

⚠️ 1.8.1 version is equivalent to 1.8.0 in term of features and fixes.

You can install the changes from this release via

    pip install dbt-athena-community==1.8.1

##### Features

-   feat: Add column meta to glue column parameters by [@&#8203;SoumayaMauthoorMOJ](https://github.com/SoumayaMauthoorMOJ) in [https://github.com/dbt-athena/dbt-athena/pull/644](https://github.com/dbt-athena/dbt-athena/pull/644)

##### Dependencies

-   chore: Update moto requirement from ~=5.0.6 to ~=5.0.7 by [@&#8203;dependabot](https://github.com/dependabot) in [https://github.com/dbt-athena/dbt-athena/pull/648](https://github.com/dbt-athena/dbt-athena/pull/648)

##### Docs

-   docs: Cleanup Python models section of README by [@&#8203;dfsnow](https://github.com/dfsnow) in [https://github.com/dbt-athena/dbt-athena/pull/643](https://github.com/dbt-athena/dbt-athena/pull/643)

#### New Contributors

-   [@&#8203;dfsnow](https://github.com/dfsnow) made their first contribution in [https://github.com/dbt-athena/dbt-athena/pull/643](https://github.com/dbt-athena/dbt-athena/pull/643)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on the first day of the month" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zODMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjM4My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJhdXRvbWVyZ2UiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants