Skip to content

Commit e6263c3

Browse files
authored
refactor: Cleanup and prepare for release (#1)
1 parent d829214 commit e6263c3

File tree

3 files changed

+23
-80
lines changed

3 files changed

+23
-80
lines changed

Firebolt.pq

Lines changed: 21 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ EnableTraceOutput = true;
1414
****************************/
1515
// The name of your ODBC driver.
1616
//
17-
Config_DriverName = "ClickHouse ODBC Driver (ANSI)";
17+
Config_DriverName = "Firebolt ODBC Driver (ANSI)";
1818

1919
Config_SqlConformance = ODBC[SQL_SC][SQL_SC_SQL92_FULL];
2020
Config_LimitClauseKind = LimitClauseKind.LimitOffset;
@@ -44,31 +44,21 @@ DatabaseType = type function (
4444
Documentation.FieldCaption = "Database",
4545
Documentation.FieldDescription = "Name of Firebolt database",
4646
Documentation.SampleValues = {"my-database"}
47-
]),
48-
optional env as (type text meta [
49-
Documentation.FieldCaption = "Env",
50-
Documentation.FieldDescription = "Environment name",
51-
Documentation.SampleValues = {"Staging", "Production"}
52-
]),
53-
optional logfile as (type text meta [
54-
Documentation.FieldCaption = "Log File",
55-
Documentation.FieldDescription = "Path to the log file"
5647
]))
5748
as table meta [
5849
Documentation.Name = "Firebolt",
5950
Documentation.LongDescription = "Firebolt ODBC connector for Power Query",
6051
Documentation.Examples = {[]}
6152
];
6253

63-
FireboltImpl = (account as text, engine as text, database as text, optional env as text, optional logfile as text) as table =>
54+
FireboltImpl = (account as text, engine as text, database as text) as table =>
6455
let
6556
ConnectionString = [
6657
Driver = Config_DriverName,
67-
Env = env,
58+
// Env = "Staging", // uncomment to use staging environment
6859
Account = account,
6960
Engine = engine,
7061
Database = database,
71-
DriverLogFile = logfile,
7262
Timeout = Config_Timeout
7363
],
7464
defaultConfig = Diagnostics.LogValue("BuildOdbcConfig", BuildOdbcConfig()),
@@ -129,70 +119,23 @@ FireboltImpl = (account as text, engine as text, database as text, optional env
129119
// For details of the format of the source table parameter, please see:
130120
// https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlcolumns-function
131121
SQLColumns = (catalogName, schemaName, tableName, columnName, source) =>
132-
let
133-
OdbcSqlType.BIT = -7,
134-
OdbcSqlType.BOOLEAN = 249,
135-
OdbcSqlType.SQL_TINYINT = -6,
136-
OdbcSqlType.INT8 = 250,
137-
OdbcSqlType.SQL_BIGINT = -5,
138-
OdbcSqlType.INT64 = 251,
139-
OdbcSqlType.FLOAT = 6,
140-
OdbcSqlType.FLOAT8 = 701,
141-
OdbcSqlType.DOUBLE = 8,
142-
OdbcSqlType.REAL = 7,
143-
OdbcSqlType.TEXT = -1,
144-
OdbcSqlType.SQL_NUMERIC = 2,
145-
OdbcSqlType.SQL_VARCHAR = 12,
146-
OdbcSqlType.SQL_WVARCHAR = -9,
147-
OdbcSqlType.FLOAT64 = 700,
148-
OdbcSqlType.NULL = 0,
149-
OdbcSqlType.UNKNOWN = 9999,
150-
OdbcSqlType.SQL_CHAR = 1,
151-
OdbcSqlType.SQL_DECIMAL = 3,
152-
OdbcSqlType.SQL_INTEGER = 4,
153-
OdbcSqlType.SQL_SMALLINT = 5,
154-
OdbcSqlType.SQL_FLOAT = 6,
155-
OdbcSqlType.SQL_REAL = 7,
156-
OdbcSqlType.SQL_DOUBLE = 8,
157-
OdbcSqlType.SQL_DATE = 9,
158-
OdbcSqlType.SQL_TIME = 10,
159-
OdbcSqlType.SQL_TIMESTAMP = 11,
160-
OdbcSqlType.SQL_LONGVARCHAR = -1,
161-
OdbcSqlType.SQL_BINARY = -2,
162-
OdbcSqlType.SQL_VARBINARY = -3,
163-
OdbcSqlType.SQL_LONGVARBINARY = -4,
164-
OdbcSqlType.SQL_BIT = -7,
165-
OdbcSqlType.SQL_WCHAR = -8,
166-
OdbcSqlType.SQL_WLONGVARCHAR = -10,
167-
OdbcSqlType.SQL_GUID = -11,
168-
169-
FixDataType = (dataType) =>
170-
// Diagnostics.CorrelationId("SQLColumns.DataType", dataType),
171-
dataType,
172-
// Not sure if this is needed
173-
FixDataTypeName = (dataTypeName) =>
174-
dataTypeName,
175-
Transform = Table.TransformColumns(source, {
176-
{"data_type", FixDataType}
177-
//, {"type_name", FixDataTypeName}
178-
})
179-
in
180-
if (EnableTraceOutput <> true) then
181-
Transform
182-
else if (
183-
// the if statement conditions will force the values to evaluated/written to diagnostics
184-
Diagnostics.LogValue("SQLColumns.TableName", tableName) <> "***"
185-
and Diagnostics.LogValue("SQLColumns.ColumnName", columnName) <> "***"
186-
) then
187-
let
188-
// Outputting the entire table might be too large, and result in the value being truncated.
189-
// We can output a row at a time instead with Table.TransformRows()
190-
rows = Table.TransformRows(Transform, each Diagnostics.LogValue("SQLColumns", _)),
191-
toTable = Table.FromRecords(rows)
192-
in
193-
Value.ReplaceType(toTable, Value.Type(Transform))
194-
else
195-
Transform,
122+
if (EnableTraceOutput <> true) then
123+
source
124+
else
125+
// the if statement conditions will force the values to evaluated/written to diagnostics
126+
if (
127+
Diagnostics.LogValue("SQLColumns.TableName", tableName) <> "***"
128+
and Diagnostics.LogValue("SQLColumns.ColumnName", columnName) <> "***"
129+
) then
130+
let
131+
// Outputting the entire table might be too large, and result in the value being truncated.
132+
// We can output a row at a time instead with Table.TransformRows()
133+
rows = Table.TransformRows(source, each Diagnostics.LogValue("SQLColumns", _)),
134+
toTable = Table.FromRecords(rows)
135+
in
136+
Value.ReplaceType(toTable, Value.Type(source))
137+
else
138+
source,
196139
// Remove null fields from the ConnectionString
197140
ConnectionStringNoNulls = Record.SelectFields(
198141
ConnectionString, Table.SelectRows(Record.ToTable(ConnectionString), each [Value] <> null)[Name]
@@ -251,7 +194,7 @@ Firebolt = [
251194

252195
// Data Source UI publishing description
253196
Firebolt.Publish = [
254-
Beta = true,
197+
Beta = false,
255198
Category = "Database",
256199
ButtonText = { Extension.LoadString("ButtonTitle"), Extension.LoadString("ButtonHelp") },
257200
LearnMoreUrl = "https://firebolt.io",

Firebolt.query.pq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Use this file to write queries to test your data connector
22
let
3-
result = Firebolt.Contents("developer", "petro_test", "petro_test_pbi", "Staging")
3+
result = Firebolt.Contents("developer", "petro_test", "petro_test_pbi")
44
in
55
result

tests/ConnectorConfigs/Firebolt/ParameterQueries/Firebolt.parameterquery.pq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
let
2-
ASource = Firebolt.Contents("developer", "petro_test", "petro_test_pbi", "staging"),
2+
ASource = Firebolt.Contents("developer", "petro_test", "petro_test_pbi"),
33
Source = ASource{[Name="public"]}[Data],
44
NycTaxiGreen_Table = Source{[Name="NycTaxiGreen"]}[Data],
55
TaxiZoneLookup_Table = Source{[Name="TaxiZoneLookup"]}[Data]

0 commit comments

Comments
 (0)