Skip to content

Commit

Permalink
fix: build remote_url from source items (#2529)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jabolol authored Nov 26, 2024
1 parent f864925 commit d1e61a3
Showing 1 changed file with 4 additions and 13 deletions.
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

0 comments on commit d1e61a3

Please sign in to comment.