Skip to content

Commit

Permalink
use schema in show file formats (#600)
Browse files Browse the repository at this point in the history
  • Loading branch information
yonieilon authored Jul 13, 2021
1 parent 90af4cf commit 0f433c5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/resources/file_format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ func expectReadFileFormat(mock sqlmock.Sqlmock) {
rows := sqlmock.NewRows([]string{
"created_on", "name", "database_name", "schema_name", "type", "owner", "comment", "format_options"},
).AddRow("2019-12-23 17:20:50.088 +0000", "test_file_format", "test_db", "test_schema", "CSV", "test", "great comment", `{"TYPE":"CSV","RECORD_DELIMITER":"\n","FIELD_DELIMITER":",","FILE_EXTENSION":null,"SKIP_HEADER":0,"DATE_FORMAT":"AUTO","TIME_FORMAT":"AUTO","TIMESTAMP_FORMAT":"AUTO","BINARY_FORMAT":"HEX","ESCAPE":"NONE","ESCAPE_UNENCLOSED_FIELD":"\\","TRIM_SPACE":false,"FIELD_OPTIONALLY_ENCLOSED_BY":"NONE","NULL_IF":["\\N"],"COMPRESSION":"AUTO","ERROR_ON_COLUMN_COUNT_MISMATCH":false,"VALIDATE_UTF8":false,"SKIP_BLANK_LINES":false,"REPLACE_INVALID_CHARACTERS":false,"EMPTY_FIELD_AS_NULL":false,"SKIP_BYTE_ORDER_MARK":false,"ENCODING":"UTF8"}`)
mock.ExpectQuery(`^SHOW FILE FORMATS LIKE 'test_file_format' IN DATABASE "test_db"$`).WillReturnRows(rows)
mock.ExpectQuery(`^SHOW FILE FORMATS LIKE 'test_file_format' IN SCHEMA "test_db"."test_schema"$`).WillReturnRows(rows)
}
2 changes: 1 addition & 1 deletion pkg/snowflake/file_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ func (ffb *FileFormatBuilder) Describe() string {

// Show returns the SQL query that will show a file format.
func (ffb *FileFormatBuilder) Show() string {
return fmt.Sprintf(`SHOW FILE FORMATS LIKE '%v' IN DATABASE "%v"`, ffb.name, ffb.db)
return fmt.Sprintf(`SHOW FILE FORMATS LIKE '%v' IN SCHEMA "%v"."%v"`, ffb.name, ffb.db, ffb.schema)
}

type fileFormatShow struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/snowflake/file_format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,5 +265,5 @@ func TestFileFormatDescribe(t *testing.T) {
func TestFileFormatShow(t *testing.T) {
r := require.New(t)
f := FileFormat("test_file_format", "test_db", "test_schema")
r.Equal(`SHOW FILE FORMATS LIKE 'test_file_format' IN DATABASE "test_db"`, f.Show())
r.Equal(`SHOW FILE FORMATS LIKE 'test_file_format' IN SCHEMA "test_db"."test_schema"`, f.Show())
}

0 comments on commit 0f433c5

Please sign in to comment.