-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SNOW-919423 Surfaces Table Schema for a Channel
We've had requests to surface the table schema for a channel so that it is possible to reason about what columns need to be supplied to a given call of `insertRow` or `insertRows`. This surfaces a map of Column Name to Column Properties that are normally surfaced in the output of `SHOW COLUMNS`. @test adds test to `SnowflakeStreamingIngestChannelTest.java`
- Loading branch information
1 parent
f57f92b
commit e38a7e5
Showing
4 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/main/java/net/snowflake/ingest/streaming/internal/ColumnProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package net.snowflake.ingest.streaming.internal; | ||
|
||
/** | ||
* Class that encapsulates column properties. These are the same properties showed in the output of | ||
* <a href="https://docs.snowflake.com/en/sql-reference/sql/show-columns">SHOW COLUMNS</a> | ||
*/ | ||
public class ColumnProperties { | ||
private String type; | ||
|
||
private String logicalType; | ||
|
||
private Integer precision; | ||
|
||
private Integer scale; | ||
|
||
private Integer byteLength; | ||
|
||
private Integer length; | ||
|
||
private boolean nullable; | ||
|
||
ColumnProperties(ColumnMetadata columnMetadata) { | ||
this.type = columnMetadata.getType(); | ||
this.logicalType = columnMetadata.getLogicalType(); | ||
this.precision = columnMetadata.getPrecision(); | ||
this.scale = columnMetadata.getScale(); | ||
this.byteLength = columnMetadata.getByteLength(); | ||
this.length = columnMetadata.getLength(); | ||
this.nullable = columnMetadata.getNullable(); | ||
} | ||
|
||
public String getType() { | ||
return type; | ||
} | ||
|
||
public String getLogicalType() { | ||
return logicalType; | ||
} | ||
|
||
public Integer getPrecision() { | ||
return precision; | ||
} | ||
|
||
public Integer getScale() { | ||
return scale; | ||
} | ||
|
||
public Integer getByteLength() { | ||
return byteLength; | ||
} | ||
|
||
public Integer getLength() { | ||
return length; | ||
} | ||
|
||
public boolean isNullable() { | ||
return nullable; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters