Skip to content

Commit

Permalink
Update main.go with sdk-cli integration
Browse files Browse the repository at this point in the history
Signed-off-by: Karanjot Singh <[email protected]>
  • Loading branch information
0xquark committed May 4, 2024
1 parent 6abd2e8 commit 5a46cb6
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main

import (
"fmt"
"github.com/atlanhq/atlan-go/atlan"
"github.com/atlanhq/atlan-go/atlan/client"
)

Expand All @@ -12,29 +11,32 @@ func main() {
client.LoggingEnabled = true
ctx := client.NewContext()

// Fetch columns of table from Atlan using Qualified Name
qualifiedname := "default/snowflake/1714501359/ANALYTICS/WIDE_WORLD_IMPORTERS/CUSTOMERR/ID"
qualifiedName := "default/snowflake/1714501359/RAW/WIDEWORLDIMPORTERS_SALESFORCE/WAITLIST_WORK_TYPE_HISTORY"

columnResult := client.NewFluentSearch().
TableResponse, _ := client.NewFluentSearch().
PageSizes(50).
ActiveAssets().
Where(ctx.Column.TYPENAME.Eq("Column")).
Where(ctx.Column.QUALIFIED_NAME.Eq(qualifiedname)).
ToRequest()
Where(ctx.Table.TYPENAME.Eq("Table")).
Where(ctx.Table.QUALIFIED_NAME.Eq(qualifiedName)).
IncludeOnResults("userDescription", "ownerUsers", "ownerGroups", "certificateStatus").
Execute()

columnResult.Metadata.UtmTags = []string{atlan.PROJECT_SDK_CLI.String()}
fmt.Println(*TableResponse[0].Entities[0].UserDescription)
/*
// Fetch columns of table from Atlan using Qualified Name
qualifiedname := "default/snowflake/1714501359/RAW/WIDEWORLDIMPORTERS_SALESFORCE/WAITLIST_WORK_TYPE_HISTORY/ID"
iterator := client.NewIndexSearchIterator(columnResult.Size, *columnResult)
columnResult, _ := client.NewFluentSearch().
PageSizes(50).
ActiveAssets().
Where(ctx.Column.TYPENAME.Eq("Column")).
Where(ctx.Column.QUALIFIED_NAME.Eq(qualifiedname)).
IncludeOnResults("userDescription", "dataType", "isPrimary", "isNullable").
Execute()
for iterator.HasMoreResults() {
responses, _ := iterator.IteratePages()
for _, response := range responses {
fmt.Println(response)
break
}
break
}
fmt.Println(*columnResult[0].Entities[0].IsPrimary)
*/
/*
if err != nil {
fmt.Printf("Error executing search: %v\n", err)
Expand Down

0 comments on commit 5a46cb6

Please sign in to comment.