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

feat: Add tables to the SDK #2042

Merged
merged 52 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
308b413
qs
sfc-gh-pbosak Jul 28, 2023
aca16a7
chantes
sfc-gh-pbosak Aug 9, 2023
ce7bfa0
Merge branch 'main' into tables-sdk-v2
sfc-gh-pbosak Aug 9, 2023
1e70498
changes
sfc-gh-pbosak Aug 14, 2023
0937ea8
changes
sfc-gh-pbosak Aug 14, 2023
ea178e5
Merge branch 'main' into tables-sdk-v2
sfc-gh-pbosak Aug 14, 2023
c0e6a08
stuff
sfc-gh-pbosak Aug 17, 2023
a0b61ea
Merge branch 'main' into tables-sdk-v2
sfc-gh-pbosak Aug 17, 2023
38148d6
changes
sfc-gh-pbosak Aug 28, 2023
30cc775
changes
sfc-gh-pbosak Aug 31, 2023
5b796f4
changes
sfc-gh-pbosak Sep 1, 2023
5932fae
Merge branch 'main' of github.com:Snowflake-Labs/terraform-provider-s…
sfc-gh-pbosak Sep 1, 2023
e2523df
changes
sfc-gh-pbosak Sep 1, 2023
bba3a83
fixes
sfc-gh-pbosak Sep 1, 2023
e4642af
fixes
sfc-gh-pbosak Sep 1, 2023
0a659ff
changes
sfc-gh-pbosak Sep 1, 2023
06ae64c
Merge branch 'main' into tables-sdk-v2
sfc-gh-asawicki Nov 20, 2023
cb1ea66
Fix minor stuff
sfc-gh-asawicki Nov 20, 2023
03d4f9d
Merge branch 'main' into tables-sdk-v2
sfc-gh-asawicki Nov 22, 2023
f193057
Use our assertion helper
sfc-gh-asawicki Nov 28, 2023
0b8d154
Fix tests
sfc-gh-asawicki Nov 28, 2023
d5ff1a7
Use our errors
sfc-gh-asawicki Nov 28, 2023
c4931f7
Use common schema and db
sfc-gh-asawicki Nov 28, 2023
0cd1860
Show by id using in syntax
sfc-gh-asawicki Nov 28, 2023
06bf8ff
Create database using SDK
sfc-gh-asawicki Nov 28, 2023
e099f72
Rename to toOpts()
sfc-gh-asawicki Nov 28, 2023
90febf6
Merge branch 'main' into tables-sdk-v2
sfc-gh-asawicki Dec 1, 2023
ee9ada1
Extract getting table columns to helper
sfc-gh-asawicki Dec 1, 2023
b1de9f9
Fix column assertions
sfc-gh-asawicki Dec 1, 2023
4611b0e
Refactor column assertions
sfc-gh-asawicki Dec 1, 2023
7748dbd
Merge two create table helper methods
sfc-gh-asawicki Dec 1, 2023
4fef9da
Add skip file x and x%
sfc-gh-asawicki Dec 1, 2023
78fcab9
Fix tests and files
sfc-gh-asawicki Dec 1, 2023
2f1d516
Add describe and fix integration tests
sfc-gh-asawicki Dec 1, 2023
09b62ba
Update comments
sfc-gh-asawicki Dec 1, 2023
252e513
Fix linter
sfc-gh-asawicki Dec 1, 2023
304ea1f
Merge branch 'main' into tables-sdk-v2
sfc-gh-asawicki Dec 1, 2023
554b251
Fix reviewdog
sfc-gh-asawicki Dec 1, 2023
56ed0c8
Fix test
sfc-gh-asawicki Dec 1, 2023
e5f3b0d
Fix after review part 1
sfc-gh-asawicki Dec 5, 2023
cf73cb5
Fix after review part 2
sfc-gh-asawicki Dec 5, 2023
517bb5d
Fix after review part 3
sfc-gh-asawicki Dec 5, 2023
3afd536
Add out of line constraint validations (WIP)
sfc-gh-asawicki Dec 5, 2023
bc46fb8
Add type presence validation
sfc-gh-asawicki Dec 6, 2023
76f50c7
Validate out of line constraints
sfc-gh-asawicki Dec 6, 2023
05b6c71
Allow multiple out of line column constraints
sfc-gh-asawicki Dec 6, 2023
f691f14
Validate out of line in alter
sfc-gh-asawicki Dec 6, 2023
551672c
Use query in create table as select
sfc-gh-asawicki Dec 6, 2023
d0aed52
Fix linter
sfc-gh-asawicki Dec 6, 2023
9acd22c
Fix after review
sfc-gh-asawicki Dec 7, 2023
ea2e35a
Merge branch 'main' into tables-sdk-v2
sfc-gh-asawicki Dec 7, 2023
6f924bd
Fix after review
sfc-gh-asawicki Dec 7, 2023
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
2 changes: 2 additions & 0 deletions pkg/sdk/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type Client struct {
SessionPolicies SessionPolicies
Sessions Sessions
Shares Shares
Tables Tables
Users Users
Schemas Schemas
Warehouses Warehouses
Expand Down Expand Up @@ -141,6 +142,7 @@ func (c *Client) initialize() {
c.Shares = &shares{client: c}
c.Schemas = &schemas{client: c}
c.SystemFunctions = &systemFunctions{client: c}
c.Tables = &tables{client: c}
c.Users = &users{client: c}
c.Warehouses = &warehouses{client: c}
}
Expand Down
15 changes: 15 additions & 0 deletions pkg/sdk/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,21 @@ func createPipe(t *testing.T, client *Client, database *Database, schema *Schema
return createdPipe, pipeCleanup
}

func createStageWithName(t *testing.T, client *Client, name string) (*string, func()) {
sfc-gh-pbosak marked this conversation as resolved.
Show resolved Hide resolved
t.Helper()
ctx := context.Background()
stageCleanup := func() {
_, err := client.exec(ctx, fmt.Sprintf("DROP STAGE %s", name))
require.NoError(t, err)
}
_, err := client.exec(ctx, fmt.Sprintf("CREATE STAGE %s", name))
if err != nil {
return nil, stageCleanup
}
require.NoError(t, err)
return &name, stageCleanup
}

func createStage(t *testing.T, client *Client, database *Database, schema *Schema, name string) (*Stage, func()) {
t.Helper()
require.NotNil(t, database, "database has to be created")
Expand Down
Loading