@@ -48,10 +48,10 @@ func findSqlxFiles(dataformRootDirectory string) *[]string {
48
48
return nil
49
49
}
50
50
51
- func formatSqlCode (sqlxFileMetaData * sqlxFileMetaData , pythonScriptPath string , sqlfluffConfigPath string , logger * slog.Logger ) error {
51
+ func formatSqlCode (sqlxFileMetaData * sqlxFileMetaData , pythonScriptPath string , sqlfluffConfigPath string , pythonExecutable string , logger * slog.Logger ) error {
52
52
queryString := * & sqlxFileMetaData .queryString
53
53
54
- cmd := exec .Command ("python" , pythonScriptPath , string (sqlfluffConfigPath ), string (queryString ))
54
+ cmd := exec .Command (pythonExecutable , pythonScriptPath , string (sqlfluffConfigPath ), string (queryString ))
55
55
56
56
var stdout bytes.Buffer
57
57
var stderr bytes.Buffer
@@ -133,14 +133,14 @@ func writeContentsToFileInPlace(sqlxFileMetaData *sqlxFileMetaData, formattingEr
133
133
}
134
134
}
135
135
136
- func formatSqlxFile (sqlxFilePath string , inplace bool , sqlfluffConfigPath string , logger * slog.Logger ) {
136
+ func formatSqlxFile (sqlxFilePath string , inplace bool , sqlfluffConfigPath string , pythonExecutable string , logger * slog.Logger ) {
137
137
sqlxFileMetaData , err := getSqlxFileMetaData (sqlxFilePath )
138
138
139
139
if err != nil {
140
140
fmt .Println ("Error finding config blocks:" , err )
141
141
} else {
142
142
pythonScriptPath := filepath .Join (".formatdataform" , "sqlfluff_formatter.py" )
143
- formattingError := formatSqlCode (& sqlxFileMetaData , pythonScriptPath , sqlfluffConfigPath , logger )
143
+ formattingError := formatSqlCode (& sqlxFileMetaData , pythonScriptPath , sqlfluffConfigPath , pythonExecutable , logger )
144
144
if inplace {
145
145
writeContentsToFileInPlace (& sqlxFileMetaData , formattingError )
146
146
} else {
0 commit comments