@@ -5,7 +5,6 @@ import snowflake from "snowflake-sdk";
5
5
6
6
export default url => {
7
7
url = new URL ( url ) ;
8
- console . log ( url ) ;
9
8
const { host : account , username, password, pathname, searchParams} = new URL (
10
9
url
11
10
) ;
@@ -66,25 +65,23 @@ export default url => {
66
65
} ;
67
66
} ;
68
67
69
- // https://www.postgresql.org/docs/9.6/datatype.html
68
+ // https://github.com/snowflakedb/snowflake-connector-nodejs/blob/master/lib/connection/result/data_types.js
70
69
const array = [ "null" , "array" ] ,
71
70
boolean = [ "null" , "boolean" ] ,
72
- // integer = ["null", "integer"],
71
+ integer = [ "null" , "integer" ] ,
73
72
number = [ "null" , "number" ] ,
74
73
object = [ "null" , "object" ] ,
75
74
string = [ "null" , "string" ] ;
76
75
function dataTypeSchema ( column ) {
77
- // https://github.com/snowflakedb/snowflake-connector-nodejs/blob/master/lib/connection/result/data_types.js
78
76
switch ( column . getType ( ) ) {
79
77
case "binary" :
80
78
return { type : object , buffer : true } ;
81
79
case "boolean" :
82
80
return { type : boolean } ;
83
81
case "fixed" :
84
82
case "real" :
85
- return { type : number } ;
83
+ return { type : column . getScale ( ) ? number : integer } ;
86
84
case "date" :
87
- case "time" :
88
85
case "timestamp_ltz" :
89
86
case "timestamp_ntz" :
90
87
case "timestamp_tz" :
@@ -94,6 +91,7 @@ function dataTypeSchema(column) {
94
91
return { type : object } ;
95
92
case "array" :
96
93
return { type : array , items : { type : object } } ;
94
+ case "time" :
97
95
case "text" :
98
96
default :
99
97
return { type : string } ;
0 commit comments