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: build remote_url from source items #2529

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions warehouse/dbt/macros/models/parse_npm_git_url.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ normalized_urls as (
select
`name`,
artifact_url,
original_url,
cleaned_url,
case
when regexp_contains(cleaned_url, r'^git\+ssh://') then
Expand All @@ -38,26 +37,18 @@ parsed_data as (
select
`name`,
artifact_url,
original_url,
normalized_url,
regexp_extract(normalized_url, r'https?://([^/]+)/') as remote_host,
regexp_extract(
normalized_url,
r'https?://[^/]+/([^/]+)/'
) as remote_namespace,
regexp_extract(
normalized_url,
r'https?://[^/]+/[^/]+/([^/.]+)'
) as remote_name
regexp_extract(normalized_url, r'https?://[^/]+/([^/]+)/') as remote_namespace,
regexp_extract(normalized_url, r'https?://[^/]+/[^/]+/([^/.]+)') as remote_name
from normalized_urls
),

final_data as (
select
`name`,
`name`,
artifact_url,
original_url,
normalized_url as remote_url,
concat('https://', remote_host, '/', remote_namespace, '/', remote_name, '.git') as remote_url,
remote_host,
remote_namespace,
remote_name,
Expand Down