-
Notifications
You must be signed in to change notification settings - Fork 361
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
Task: Support Azure Unity Catalog export #7554
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
esti/export_hooks_files/delta/azure_adls/_lakefs_actions/delta_export.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Delta Exporter | ||
on: | ||
post-commit: | ||
branches: ["{{ .Branch }}*"] | ||
hooks: | ||
- id: delta_exporter | ||
type: lua | ||
properties: | ||
script: | | ||
local azure = require("azure") | ||
local formats = require("formats") | ||
local delta_exporter = require("lakefs/catalogexport/delta_exporter") | ||
local json = require("encoding/json") | ||
|
||
local table_descriptors_path = "_lakefs_tables" | ||
local sc = azure.blob_client(args.azure.storage_account, args.azure.access_key) | ||
local function write_object(_, key, buf) | ||
return sc.put_object(key,buf) | ||
end | ||
local delta_client = formats.delta_client(args.lakefs.access_key_id, args.lakefs.secret_access_key) | ||
local delta_table_details = delta_exporter.export_delta_log(action, args.table_names, write_object, delta_client, table_descriptors_path, azure.abfss_transform_path) | ||
|
||
for t, details in pairs(delta_table_details) do | ||
if details["path"] == nil then | ||
error("Delta Lake exported table \"" .. t .. "\"'s location is not available\n") | ||
end | ||
print("Delta Lake exported table \"" .. t .. "\"'s location: " .. details["path"] .. "\n") | ||
if details["metadata"] == nil then | ||
error("Delta Lake exported table \"" .. t .. "\"'s metadata is not available\n") | ||
end | ||
print("Delta Lake exported table \"" .. t .. "\"'s metadata:\n") | ||
for k, v in pairs(details["metadata"]) do | ||
if type(v) ~= "table" then | ||
print("\t" .. k .. " = " .. v .. "\n") | ||
else | ||
print("\t" .. k .. " = " .. json.marshal(v) .. "\n") | ||
end | ||
end | ||
end | ||
args: | ||
azure: | ||
storage_account: "{{ .AzureStorageAccount }}" | ||
access_key: "{{ .AzureAccessKey }}" | ||
lakefs: # provide credentials of a user that has access to the script and Delta Table | ||
access_key_id: "{{ .LakeFSAccessKeyID }}" | ||
secret_access_key: "{{ .LakeFSSecretAccessKey }}" | ||
table_names: | ||
- test-table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--[[ | ||
As an exhaustive example, it will first start off with a Delta Lake tables export, then continue to register the table | ||
with Unity Catalog | ||
]] | ||
|
||
local azure = require("azure") | ||
local formats = require("formats") | ||
local databricks = require("databricks") | ||
local delta_exporter = require("lakefs/catalogexport/delta_exporter") | ||
local unity_exporter = require("lakefs/catalogexport/unity_exporter") | ||
|
||
local table_descriptors_path = "_lakefs_tables" | ||
local sc = azure.blob_client(args.azure.storage_account, args.azure.access_key) | ||
local function write_object(_, key, buf) | ||
return sc.put_object(key,buf) | ||
end | ||
local delta_client = formats.delta_client(args.lakefs.access_key_id, args.lakefs.secret_access_key) | ||
local delta_table_details = delta_exporter.export_delta_log(action, args.table_defs, write_object, delta_client, table_descriptors_path, azure.abfss_transform_path) | ||
|
||
-- Register the exported table in Unity Catalog: | ||
local databricks_client = databricks.client(args.databricks_host, args.databricks_token) | ||
local registration_statuses = unity_exporter.register_tables(action, "_lakefs_tables", delta_table_details, databricks_client, args.warehouse_id) | ||
for t, status in pairs(registration_statuses) do | ||
print("Unity catalog registration for table \"" .. t .. "\" completed with status: " .. status .. "\n") | ||
end |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update the
export_delta_log
method with the new parameter?