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

Add data sources for retrieving UC tables #1155

Merged
merged 4 commits into from
Mar 7, 2022
Merged

Add data sources for retrieving UC tables #1155

merged 4 commits into from
Mar 7, 2022

Conversation

nfx
Copy link
Contributor

@nfx nfx commented Mar 4, 2022

  • Added databricks_catalogs data
  • Added databricks_schemas data
  • Added databricks_tables data
data "databricks_schemas" "sandbox" {
  catalog_name = "sandbox"
}

output "all_sandbox_schemas" {
  value = data.databricks_schemas.sandbox
}

data "databricks_tables" "things" {
  catalog_name = "sandbox"
  schema_name = "things"
}

output "all_things_tables" {
  value = data.databricks_tables.things
}

data "databricks_catalogs" "all" {}

output "all_catalogs" {
  value = data.databricks_catalogs.all
}

Fixes #1105

@nfx nfx requested a review from alexott March 4, 2022 19:13
@nfx
Copy link
Contributor Author

nfx commented Mar 4, 2022

Tests will follow next week

@codecov
Copy link

codecov bot commented Mar 4, 2022

Codecov Report

Merging #1155 (64d2add) into master (5f03672) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1155      +/-   ##
==========================================
+ Coverage   90.79%   90.82%   +0.03%     
==========================================
  Files         114      117       +3     
  Lines        9692     9725      +33     
==========================================
+ Hits         8800     8833      +33     
  Misses        526      526              
  Partials      366      366              
Impacted Files Coverage Δ
common/version.go 100.00% <ø> (ø)
catalog/data_catalogs.go 100.00% <100.00%> (ø)
catalog/data_schemas.go 100.00% <100.00%> (ø)
catalog/data_tables.go 100.00% <100.00%> (ø)
catalog/resource_catalog.go 94.28% <100.00%> (+0.34%) ⬆️
catalog/resource_schema.go 100.00% <100.00%> (ø)
catalog/resource_table.go 100.00% <100.00%> (ø)
provider/provider.go 94.81% <100.00%> (+0.11%) ⬆️
qa/testing.go 86.47% <100.00%> (-0.51%) ⬇️

nfx added 3 commits March 4, 2022 20:19
* Added `databricks_catalogs` data
* Added `databricks_schemas` data
* Added `databricks_tables` data

Fixes #1105
* Added `databricks_catalogs` data
* Added `databricks_schemas` data
* Added `databricks_tables` data

Fixes #1105
catalog/data_catalogs.go Show resolved Hide resolved
catalog/data_schemas.go Show resolved Hide resolved
catalog/data_tables.go Show resolved Hide resolved
catalog/data_catalogs.go Show resolved Hide resolved
@alexott
Copy link
Contributor

alexott commented Mar 5, 2022

from code perspective looks ok, will wait for tests

@nfx nfx merged commit 5a48a24 into master Mar 7, 2022
@nfx nfx deleted the issue/1105 branch March 7, 2022 11:51
@nfx nfx mentioned this pull request Mar 7, 2022
@vadivelselvaraj
Copy link

vadivelselvaraj commented Apr 27, 2022

@nfx would databricks_tables cover Unity Catalog views as well?

michael-berk pushed a commit to michael-berk/terraform-provider-databricks that referenced this pull request Feb 15, 2023
Add data sources for retrieving UC entity names:

```hcl
data "databricks_schemas" "sandbox" {
  catalog_name = "sandbox"
}

output "all_sandbox_schemas" {
  value = data.databricks_schemas.sandbox
}

data "databricks_tables" "things" {
  catalog_name = "sandbox"
  schema_name = "things"
}

output "all_things_tables" {
  value = data.databricks_tables.things
}

data "databricks_catalogs" "all" {}

output "all_catalogs" {
  value = data.databricks_catalogs.all
}
```

Fixes databricks#1105
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.

[feat] Create data resource to get tables/views within a Unity Catalog database
3 participants