@@ -11,22 +11,13 @@ import (
1111
1212// Constants for data types
1313const (
14- integerType = "integer"
15- smallintType = "smallint"
16- bigintType = "bigint"
17- floatType = "float"
18- decimalType = "decimal"
19- varcharType = "varchar"
20- charType = "char"
21- textType = "text"
22- dateType = "date"
23- timestampType = "timestamp"
24- timestamptzType = "timestamptz"
25- doubleType = "double"
26- booleanType = "boolean"
27- jsonType = "json"
28- intervalType = "interval"
29- postgresType = "postgres"
14+ integerType = "integer"
15+ varcharType = "varchar"
16+ dateType = "date"
17+ timestampType = "timestamp"
18+ doubleType = "double"
19+ booleanType = "boolean"
20+ postgresType = "postgres"
3021)
3122
3223// Constants for SQL data types
@@ -88,8 +79,6 @@ func convertConnectionToDataSource(conn DbtConnection, dbtHomePath, profileName,
8879 return convertToPostgresDataSource (conn )
8980 case "duckdb" :
9081 return convertToLocalFileDataSource (conn , dbtHomePath )
91- case "sqlserver" :
92- return convertToMSSQLDataSource (conn )
9382 case "mysql" :
9483 return convertToMysqlDataSource (conn )
9584 default :
@@ -125,26 +114,6 @@ func convertToPostgresDataSource(conn DbtConnection) (*WrenPostgresDataSource, e
125114 return ds , nil
126115}
127116
128- func convertToMSSQLDataSource (conn DbtConnection ) (* WrenMSSQLDataSource , error ) {
129- port := strconv .Itoa (conn .Port )
130- if conn .Port == 0 {
131- port = "1433"
132- }
133-
134- ds := & WrenMSSQLDataSource {
135- Database : conn .Database ,
136- Host : conn .Server ,
137- Port : port ,
138- User : conn .User ,
139- Password : conn .Password ,
140- TdsVersion : "8.0" , // the default tds version for Wren engine image
141- Driver : "ODBC Driver 18 for SQL Server" , // the driver used by Wren engine image
142- Kwargs : map [string ]interface {}{"TrustServerCertificate" : "YES" },
143- }
144-
145- return ds , nil
146- }
147-
148117// convertToLocalFileDataSource converts to local file data source
149118func convertToLocalFileDataSource (conn DbtConnection , dbtHome string ) (* WrenLocalFileDataSource , error ) {
150119 // For file types, we need to get URL and format info from Additional fields
@@ -295,85 +264,6 @@ func (ds *WrenPostgresDataSource) MapType(sourceType string) string {
295264 return sourceType
296265}
297266
298- type WrenMSSQLDataSource struct {
299- Database string `json:"database"`
300- Host string `json:"host"`
301- Port string `json:"port"`
302- User string `json:"user"`
303- Password string `json:"password"`
304- TdsVersion string `json:"tds_version"`
305- Driver string `json:"driver"`
306- Kwargs map [string ]interface {} `json:"kwargs"`
307- }
308-
309- func (ds * WrenMSSQLDataSource ) GetType () string {
310- return "mssql"
311- }
312-
313- func (ds * WrenMSSQLDataSource ) Validate () error {
314- if ds .Host == "" {
315- return fmt .Errorf ("host cannot be empty" )
316- }
317- if ds .Database == "" {
318- return fmt .Errorf ("database cannot be empty" )
319- }
320- if ds .User == "" {
321- return fmt .Errorf ("user cannot be empty" )
322- }
323- if ds .Port == "" {
324- return fmt .Errorf ("port must be specified" )
325- }
326- port , err := strconv .Atoi (ds .Port )
327- if err != nil {
328- return fmt .Errorf ("port must be a valid number" )
329- }
330- if port <= 0 || port > 65535 {
331- return fmt .Errorf ("port must be between 1 and 65535" )
332- }
333- if ds .Password == "" {
334- return fmt .Errorf ("password cannot be empty" )
335- }
336- return nil
337- }
338-
339- func (ds * WrenMSSQLDataSource ) MapType (sourceType string ) string {
340- // This method is not used in WrenMSSQLDataSource, but required by DataSource interface
341- switch strings .ToLower (sourceType ) {
342- case charType , "nchar" :
343- return charType
344- case varcharType , "nvarchar" :
345- return varcharType
346- case textType , "ntext" :
347- return textType
348- case "bit" , "tinyint" :
349- return booleanType
350- case "smallint" :
351- return smallintType
352- case "int" :
353- return integerType
354- case "bigint" :
355- return bigintType
356- case booleanType :
357- return booleanType
358- case "float" , "real" :
359- return floatType
360- case "decimal" , "numeric" , "money" , "smallmoney" :
361- return decimalType
362- case "date" :
363- return dateType
364- case "datetime" , "datetime2" , "smalldatetime" :
365- return timestampType
366- case "time" :
367- return intervalType
368- case "datetimeoffset" :
369- return timestamptzType
370- case "json" :
371- return jsonType
372- default :
373- return strings .ToLower (sourceType )
374- }
375- }
376-
377267type WrenMysqlDataSource struct {
378268 Database string `json:"database"`
379269 Host string `json:"host"`
0 commit comments