Widget for Database.connect (#11216)

- Use auto-scoping for Redshift, SQLServer and Snowflake.
![image](https://github.com/user-attachments/assets/2f5ff24a-44f4-4e87-909a-e064b8653511)
- Fix for widgets on Header functions.
![image](https://github.com/user-attachments/assets/4384efcf-a4da-48b1-b571-1167ca8d0134)
- Move `Snowflake_Details` to `Standard.Snowflake.Connection` namespace to make widgets work.
- Add widgets to `Snowflake_Details`.
![image](https://github.com/user-attachments/assets/b51d0126-a768-4f4a-9d87-c42c8e91e26b)
- Typo fix for SQLServer SPI.
- Change SQLServer port to be an Integer and added default.
- Reordered parameters on SQLServer **(potentially breaking change)**.
- Added widgets to SQLServer.
![image](https://github.com/user-attachments/assets/1c744da4-7913-4a87-9e64-fc10442a06eb)
- Added widget for JDBC options (as well as conversion from Vector to options).
![image](https://github.com/user-attachments/assets/4958b1e4-4cbc-43e3-8381-64e5ce7ea8ff)
- Added header alias to `use_first_row_as_names`.
- Added various aliases to `read` and `write`.
This commit is contained in:
James Dunkerley 2024-10-01 09:43:03 +01:00 committed by GitHub
parent ddbb8e22bd
commit 6ea716f1b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
36 changed files with 167 additions and 54 deletions

View File

@ -1,4 +1,6 @@
from Standard.Base import all
import Standard.Base.Errors.Common.Missing_Argument
import Standard.Base.Metadata.Widget.Text_Input
import Standard.Database.Connection.Client_Certificate.Client_Certificate
import Standard.Database.Connection.Connection.Connection
@ -20,14 +22,21 @@ type Redshift_Details
## Connect to a AWS Redshift database.
Arguments:
- host: The hostname of the database server (defaults to localhost).
- port: The port of the database server (defaults to 5432).
- host: The hostname of the database server.
- port: The port of the database server (defaults to 5439).
- schema: The schema to connect to (if not provided or empty, the default schema will be used).
- db_user: The user to connect to the database as.
- credentials: The credentials to use for the connection (defaults AWS_Profile).
- use_ssl: Whether to use SSL (defaults to `SSL_Mode.Require`).
- client_cert: The client certificate to use or `Nothing` if not needed.
Redshift (host:Text) (port:Integer=5439) (schema:Text='') (db_user:Text='') (credentials:Credentials|AWS_Credential=AWS_Credential.Profile) (use_ssl:SSL_Mode=SSL_Mode.Require) (client_cert:Client_Certificate|Nothing=Nothing)
@host (Text_Input display=..Always)
Redshift (host:Text=(Missing_Argument.throw "host")) (port:Integer=5439) (schema:Text='') (db_user:Text='') (credentials:Credentials|AWS_Credential=AWS_Credential.Profile) (use_ssl:SSL_Mode=..Require) (client_cert:Client_Certificate|Nothing=Nothing)
## PRIVATE
Attempt to resolve the constructor.
resolve : Function -> Redshift_Details | Nothing
resolve constructor =
Panic.catch Any (constructor:Redshift_Details) _->Nothing
## PRIVATE
Build the Connection resource.
@ -39,10 +48,6 @@ type Redshift_Details
if Driver.isRegistered.not then Driver.register
properties = options.merge self.jdbc_properties
java_props = Properties.new
properties.each pair->
java_props.setProperty pair.first pair.second
jdbc_connection = JDBC_Connection.create self.jdbc_url properties
# TODO [RW] can we inherit these from postgres?

View File

@ -106,7 +106,7 @@ type S3_File
response_body = translate_file_errors self <| S3.get_object self.s3_path.bucket self.s3_path.key self.credentials delimiter=S3_Path.delimiter
response_body.with_stream action
## ALIAS load, open
## ALIAS load, open, import
GROUP Standard.Base.Input
ICON data_input

View File

@ -212,7 +212,8 @@ type XML_Document
XML_Error.handle_java_exceptions <|
XML_Utils.innerXML self.java_document
## GROUP Output
## ALIAS export, save, output, to_file
GROUP Output
ICON data_output
Writes (or appends) the xml to the specified file using the supplied
encoding. The behavior specified in the `existing_file` parameter will be
@ -574,7 +575,8 @@ type XML_Element
XML_Error.handle_java_exceptions <|
XML_Utils.innerXML self.java_element
## GROUP Output
## ALIAS export, save, output, to_file
GROUP Output
ICON data_output
Writes (or appends) the xml to the specified file using the supplied
encoding. The behavior specified in the `existing_file` parameter will be

View File

@ -256,7 +256,7 @@ type Enso_File
Error.throw (Illegal_Argument.Error "Only files can be opened as a stream.")
response.if_not_error <| response.body.with_stream action
## ALIAS load, open
## ALIAS load, open, import
GROUP Input
ICON data_input
Read a file using the specified file format

View File

@ -43,6 +43,7 @@ type Header
import Standard.Base.Network.HTTP.Header.Header
example_new = Header.new "My_Header" "my header's value"
@value make_text_secret_selector
new : Text -> Text | Enso_Secret | Derived_Secret_Value -> Header
new name:Text value:(Text | Enso_Secret | Derived_Secret_Value) = Header.Value name value
@ -87,6 +88,7 @@ type Header
import Standard.Base.Network.HTTP.Header.Header
example_auth = Header.authorization "foo"
@value make_text_secret_selector
authorization : Text | Enso_Secret | Derived_Secret_Value -> Header
authorization (value : Text | Enso_Secret | Derived_Secret_Value) = Header.Value "Authorization" value
@ -103,6 +105,8 @@ type Header
import Standard.Base.Network.HTTP.Header.Header
example_auth_basic = Header.authorization_basic "user" "pass"
@user make_text_secret_selector
@pass make_text_secret_selector
authorization_basic : Text | Enso_Secret | Derived_Secret_Value -> Text | Enso_Secret | Derived_Secret_Value -> Header
authorization_basic (user : Text | Enso_Secret | Derived_Secret_Value) (pass : Text | Enso_Secret | Derived_Secret_Value) =
pair = (Derived_Secret_Value.from user) + (Derived_Secret_Value.from ":") + (Derived_Secret_Value.from pass)
@ -114,6 +118,7 @@ type Header
Arguments:
- token: The token.
@token make_text_secret_selector
authorization_bearer : Text | Enso_Secret | Derived_Secret_Value -> Header
authorization_bearer (token : Text | Enso_Secret | Derived_Secret_Value) =
value = ((Derived_Secret_Value.from "Bearer ") + (Derived_Secret_Value.from token))
@ -134,6 +139,8 @@ type Header
import Standard.Base.Network.HTTP.Header.Header
example_content_type = Header.content_type "my_type"
@value content_type_widget
@encoding Encoding.default_widget
content_type : Text -> Encoding | Nothing -> Header
content_type value:Text encoding:(Encoding | Nothing)=Nothing =
charset = if encoding.is_nothing then "" else "; charset="+encoding.character_set_name
@ -204,7 +211,6 @@ type Header
text_plain : Header
text_plain = Header.content_type "text/plain"
## PRIVATE
Convert to a display representation of this Header.
to_display_text : Text

View File

@ -175,7 +175,7 @@ type Response
decode_as_json self (encoding : Encoding | Infer = Infer) =
self.body.decode_as_json encoding
## ALIAS to_file
## ALIAS export, save, output, to_file
GROUP Output
ICON data_download
Write response body to a File.

View File

@ -162,7 +162,7 @@ type Response_Body
to_text : Text
to_text self = "Response_Body"
## ALIAS to_file
## ALIAS export, save, output, to_file
GROUP Output
ICON data_output
Write response body to a File.

View File

@ -262,7 +262,7 @@ type File
just_file_options = open_options.filter opt-> opt.is_a File_Access
Managed_Resource.bracket (new_input_stream self just_file_options) (_.close) action
## ALIAS load, open
## ALIAS load, open, import
GROUP Input
ICON data_input
Read a file using the specified file format

View File

@ -21,7 +21,8 @@ from project.Metadata import Display, Widget
polyglot java import org.enso.base.Array_Utils
## GROUP Output
## ALIAS export, save, output, to_file
GROUP Output
ICON data_output
Writes (or appends) the text to the specified file using the supplied
encoding. The behavior specified in the `existing_file` parameter will be

View File

@ -5,7 +5,6 @@ import project.Connection.Connection.Connection
import project.Connection.Connection_Options.Connection_Options
from project.Errors import SQL_Error
## Specifies the connection details for the database.
This is an interface that is implemented by particular database types, like

View File

@ -1,9 +1,14 @@
from Standard.Base import all
import Standard.Base.Metadata.Widget
from Standard.Base.Metadata.Choice import Option
from Standard.Base.Metadata.Widget import Single_Choice, Text_Input, Vector_Editor
from Standard.Base.Widget_Helpers import make_text_secret_selector
type Connection_Options
## Additional customization options for the JDBC connection.
Hold a set of key value pairs used to configure the connection.
@options Connection_Options.default_widget
Value options:Vector=[]
## PRIVATE
@ -12,3 +17,16 @@ type Connection_Options
merge : Vector -> Vector
merge self base_options =
base_options.filter x->(self.options.any (y->y.first==x.first) . not) + self.options
## PRIVATE
Widget to design connection options.
default_widget : Widget
default_widget =
fqn = Meta.get_qualified_type_name Pair . drop (..Last 5)
default = 'pair "key" "value"'
pair = Option "Pair" fqn+".pair" [["first", Text_Input], ["second", make_text_secret_selector]]
item_editor = Single_Choice display=..Always values=[pair]
Vector_Editor item_editor=item_editor display=..Always item_default=default
## PRIVATE
Connection_Options.from (that:Vector) = Connection_Options.Value that

View File

@ -19,9 +19,11 @@ polyglot java import org.enso.database.DatabaseConnectionDetailsSPI
- details: `Connection_Details` specifying the database to connect to.
- options: Additional custom connection options for the JDBC connection.
@details connection_details_widget
@options Connection_Options.default_widget
connect : Connection_Details -> Connection_Options -> Connection ! SQL_Error
connect details options=Connection_Options.Value =
details.connect options
connect details options:Connection_Options=..Value = case details of
_ : Function -> (resolve_constructor details) . connect options
_ -> details.connect options
## PRIVATE
connection_details_widget : Widget
@ -33,3 +35,14 @@ connection_details_widget =
code = pair.second
Option name code
Single_Choice display=Display.Always values=choices
## PRIVATE
resolve_constructor : Function -> Any
resolve_constructor constructor =
types = Vector.from_polyglot_array (DatabaseConnectionDetailsSPI.get_types False)
try_next idx =
if idx >= types.length then constructor else
db_type = types.at idx
resolved = db_type.resolve constructor
if resolved.is_nothing then @Tail_Call try_next (idx + 1) else resolved
try_next 0

View File

@ -30,6 +30,12 @@ type Postgres
@credentials Credentials.default_widget
Server (host:Text=default_postgres_host) (port:Integer=default_postgres_port) (database:Text=default_postgres_database) (schema:Text="") (credentials:(Credentials|Nothing)=Nothing) (use_ssl:SSL_Mode=SSL_Mode.Prefer) (client_cert:(Client_Certificate|Nothing)=Nothing)
## PRIVATE
Attempt to resolve the constructor.
resolve : Function -> Postgres | Nothing
resolve constructor =
Panic.catch Any (constructor:Postgres) _->Nothing
## PRIVATE
Build the Connection resource.

View File

@ -136,7 +136,8 @@ type Postgres_Connection
tables self name_like=Nothing database=self.database schema=Nothing types=self.dialect.default_table_types all_fields=False =
self.connection.tables name_like database schema types all_fields
## GROUP Standard.Base.Input
## ALIAS read, load, open, import
GROUP Standard.Base.Input
ICON data_input
Set up a query returning a Table object, which can be used to work with
data within the database or load it into memory.
@ -157,7 +158,8 @@ type Postgres_Connection
query : SQL_Query -> Text -> DB_Table ! Table_Not_Found
query self query:SQL_Query alias="" = self.connection.query query alias
## GROUP Standard.Base.Input
## ALIAS query, load, open, import
GROUP Standard.Base.Input
ICON data_input
Execute the query and load the results into memory as a Table.

View File

@ -1,4 +1,5 @@
from Standard.Base import all
import Standard.Base.Errors.Common.Missing_Argument
import project.Connection.Connection_Options.Connection_Options
import project.Connection.SQLite_Connection.SQLite_Connection
@ -8,11 +9,17 @@ type SQLite
Arguments:
- location: Location of the SQLite database to connect to.
From_File (location:File)
From_File (location:File=(Missing_Argument.throw "location"))
## Connect to a SQLite In Memory.
In_Memory
## PRIVATE
Attempt to resolve the constructor.
resolve : Function -> SQLite | Nothing
resolve constructor =
Panic.catch Any (constructor:SQLite) _->Nothing
## PRIVATE
Build the Connection resource.

View File

@ -124,7 +124,8 @@ type SQLite_Connection
tables self name_like=Nothing database=self.database schema=Nothing types=self.dialect.default_table_types all_fields=False =
self.connection.tables name_like database schema types all_fields
## GROUP Standard.Base.Input
## ALIAS read, load, open, import
GROUP Standard.Base.Input
ICON data_input
Set up a query returning a Table object, which can be used to work with
data within the database or load it into memory.
@ -145,7 +146,8 @@ type SQLite_Connection
query : SQL_Query -> Text -> DB_Table ! Table_Not_Found
query self query:SQL_Query alias="" = self.connection.query query alias
## GROUP Standard.Base.Input
## ALIAS query, load, open, import
GROUP Standard.Base.Input
ICON data_input
Execute the query and load the results into memory as a Table.

View File

@ -103,7 +103,8 @@ type DB_Column
info : Table
info self -> Table = self.to_table.column_info
## GROUP Standard.Base.Input
## ALIAS load, import
GROUP Standard.Base.Input
ICON data_input
Returns a materialized column containing rows of this column.

View File

@ -596,7 +596,7 @@ type DB_Table
Warning.with_suspended new_names names->
self.updated_columns (self.internal_columns.map c-> c.rename (names.at c.name))
## ALIAS rename
## ALIAS rename, header
GROUP Standard.Base.Metadata
ICON table_edit
Returns a new table with the columns renamed based on entries in the
@ -2548,7 +2548,8 @@ type DB_Table
table = self.connection.read_statement sql
table.at column_name . at 0
## GROUP Standard.Base.Input
## ALIAS load, import
GROUP Standard.Base.Input
ICON data_input
Returns a materialized dataframe containing rows of this table.
@ -2714,7 +2715,8 @@ type DB_Table
to_text : Text
to_text self = "(Database Table "+self.name.to_text+")"
## GROUP Standard.Base.Output
## ALIAS export, save, output, to_file
GROUP Standard.Base.Output
ICON data_output
This function writes the table into a file.

View File

@ -46,6 +46,7 @@ type Image
Image.Value (Java_Image.from_vector values rows channels)
## UNSTABLE
ALIAS load, open, import
ICON data_input
Read an image from a file.
@ -79,6 +80,7 @@ type Image
Error.throw (File_Error.IO_Error location 'Failed to read the file')
## UNSTABLE
ALIAS export, save, output, to_file
ICON data_output
Write an image to a file.

View File

@ -1,6 +1,8 @@
from Standard.Base import all
import Standard.Base.Data.Numbers.Number_Parse_Error
import Standard.Base.Errors.Common.Missing_Argument
import Standard.Base.Errors.Illegal_State.Illegal_State
import Standard.Base.Metadata.Widget.Text_Input
import Standard.Database.Connection.Connection_Options.Connection_Options
import Standard.Database.Connection.Credentials.Credentials
@ -12,10 +14,18 @@ type SQLServer_Details
Arguments:
- host: The name of the server to connect to.
- port: The port to connect to.
- credentials: The credentials to use for the connection.
- port: The port to connect to (defaults to 1433).
- database: The name of the database to connect to.
SQLServer host:Text port:Text credentials:Credentials database:Text="master"
@host (Text_Input display=..Always)
@credentials Credentials.default_widget
SQLServer (host:Text=(Missing_Argument.throw "host")) (credentials:Credentials=(Missing_Argument.throw "credentials")) port:Integer=1433 database:Text="master"
## PRIVATE
Attempt to resolve the constructor.
resolve : Function -> SQLServer_Details | Nothing
resolve constructor =
Panic.catch Any (constructor:SQLServer_Details) _->Nothing
## PRIVATE
Build the Connection resource.
@ -26,7 +36,7 @@ type SQLServer_Details
connect self options =
properties = options.merge self.jdbc_properties
make_new database =
SQLServer_Details.SQLServer self.host self.port self.credentials (database.if_nothing self.database) . connect options
SQLServer_Details.SQLServer self.host self.credentials self.port (database.if_nothing self.database) . connect options
SQLServer_Connection.create self.jdbc_url properties make_new
@ -34,7 +44,7 @@ type SQLServer_Details
Provides the jdbc url for the connection.
jdbc_url : Text
jdbc_url self =
'jdbc:sqlserver://' + self.host + ':' + self.port
'jdbc:sqlserver://' + self.host + ':' + self.port.to_text
## PRIVATE
Provides the properties for the connection.

View File

@ -1 +1 @@
export project.SQLServer_Details.SQLServer_Details
export project.Connection.SQLServer_Details.SQLServer_Details

View File

@ -133,7 +133,8 @@ type SQLServer_Connection
parsed_schema = if schema == "*" then Nothing else (if schema == "" then self.schema else schema)
self.connection.tables (if name_like == "" then Nothing else name_like) parsed_database parsed_schema types all_fields
## GROUP Standard.Base.Input
## ALIAS read, load, open, import
GROUP Standard.Base.Input
ICON data_input
Set up a query returning a Table object, which can be used to work with
data within the database or load it into memory.
@ -154,7 +155,8 @@ type SQLServer_Connection
query : SQL_Query -> Text -> DB_Table ! Table_Not_Found
query self query:SQL_Query alias="" = self.connection.query query alias
## GROUP Standard.Base.Input
## ALIAS query, load, open, import
GROUP Standard.Base.Input
ICON data_input
Execute the query and load the results into memory as a Table.

View File

@ -1,6 +1,8 @@
from Standard.Base import all
import Standard.Base.Data.Numbers.Number_Parse_Error
import Standard.Base.Errors.Common.Missing_Argument
import Standard.Base.Errors.Illegal_State.Illegal_State
import Standard.Base.Metadata.Widget.Text_Input
import Standard.Database.Connection.Connection_Options.Connection_Options
import Standard.Database.Connection.Credentials.Credentials
@ -18,7 +20,15 @@ type Snowflake_Details
- database: The name of the database to connect to.
- schema: The name of the schema to connect to.
- warehouse: The name of the warehouse to use.
Snowflake account:Text credentials:Credentials database:Text="SNOWFLAKE" schema:Text="PUBLIC" warehouse:Text=""
@account (Text_Input display=..Always)
@credentials Credentials.default_widget
Snowflake (account:Text=(Missing_Argument.throw "account")) (credentials:Credentials=(Missing_Argument.throw "credentials")) database:Text="SNOWFLAKE" schema:Text="PUBLIC" warehouse:Text=""
## PRIVATE
Attempt to resolve the constructor.
resolve : Function -> Snowflake_Details | Nothing
resolve constructor =
Panic.catch Any (constructor:Snowflake_Details) _->Nothing
## PRIVATE
Build the Connection resource.

View File

@ -1 +1 @@
export project.Snowflake_Details.Snowflake_Details
export project.Connection.Snowflake_Details.Snowflake_Details

View File

@ -156,7 +156,8 @@ type Snowflake_Connection
parsed_schema = if schema == "*" then Nothing else (if schema == "" then self.schema else schema)
self.connection.tables (if name_like == "" then Nothing else name_like) parsed_database parsed_schema types all_fields
## GROUP Standard.Base.Input
## ALIAS read, load, open, import
GROUP Standard.Base.Input
ICON data_input
Set up a query returning a Table object, which can be used to work with
data within the database or load it into memory.
@ -177,7 +178,8 @@ type Snowflake_Connection
query : SQL_Query -> Text -> DB_Table ! Table_Not_Found
query self query:SQL_Query alias="" = self.connection.query query alias
## GROUP Standard.Base.Input
## ALIAS query, load, open, import
GROUP Standard.Base.Input
ICON data_input
Execute the query and load the results into memory as a Table.

View File

@ -6,7 +6,7 @@ from Standard.Base.Enso_Cloud.Public_Utils import get_optional_field, get_requir
import Standard.Database.Connection.Connection_Options.Connection_Options
import Standard.Database.Connection.Credentials.Credentials
import project.Snowflake_Details.Snowflake_Details
import project.Connection.Snowflake_Details.Snowflake_Details
## PRIVATE
type Snowflake_Data_Link

View File

@ -2280,7 +2280,8 @@ type Column
if storage.isNothing index then Nothing else
java_to_enso <| storage.getItem index
## ICON data_input
## PRIVATE
ICON data_input
Returns a column containing rows of this column.
Arguments:

View File

@ -210,7 +210,7 @@ type Excel_Workbook
_ = [alias]
self.read query headers=headers
## ALIAS get, range, sheet, worksheet
## ALIAS get, range, sheet, worksheet, import, load, open
GROUP Standard.Base.Input
ICON data_input
Read a range into a Table.

View File

@ -992,7 +992,7 @@ type Table
Warning.with_suspended new_names names->
Table.new (self.columns.map c-> c.rename (names.at c.name))
## ALIAS rename
## ALIAS rename, header
GROUP Standard.Base.Metadata
ICON table_edit
Returns a new table with the columns renamed based on entries in the
@ -3025,7 +3025,8 @@ type Table
row_count : Integer
row_count self = self.java_table.rowCount
## ICON data_input
## PRIVATE
ICON data_input
Returns a materialized dataframe containing rows of this table.
In the in-memory backend, this returns the same table, truncated to
@ -3281,7 +3282,8 @@ type Table
mask = OrderMask.reverse self.row_count
Table.Value <| self.java_table.applyMask mask
## GROUP Standard.Base.Output
## ALIAS export, save, output, to_file
GROUP Standard.Base.Output
ICON data_output
This function writes a table from memory into a file.

View File

@ -66,7 +66,7 @@ type Hyper_File
_ -> HyperReader.listTables self.file.path schema
array.map t-> Hyper_Table.Value self t.schema t.name
## ALIAS get, sheet
## ALIAS get, sheet, load, open, import
GROUP Standard.Base.Input
ICON data_input
Read a table from the Hyper_File into a Table.

View File

@ -82,7 +82,8 @@ type Hyper_Table
cols = self.column_metadata
Table.new [["Column", cols.map .name], ["Value Type", cols.map .value_type], ["Nullable", cols.map .nullable]]
## GROUP Standard.Base.Input
## ALIAS load, open, import
GROUP Standard.Base.Input
ICON data_input
Reads the Table into Enso Table

View File

@ -16,7 +16,7 @@ public class RedshiftConnectionDetailsSPI extends DatabaseConnectionDetailsSPI {
@Override
protected String getCodeForDefaultConstructor() {
return "(Redshift host=_ port=_)";
return "..Redshift";
}
@Override

View File

@ -1,6 +1,8 @@
package org.enso.database;
import java.util.ServiceLoader;
import org.enso.base.polyglot.EnsoMeta;
import org.graalvm.polyglot.Value;
public abstract class DatabaseConnectionDetailsSPI {
private static final ServiceLoader<DatabaseConnectionDetailsSPI> loader =
@ -27,6 +29,23 @@ public abstract class DatabaseConnectionDetailsSPI {
.toArray(String[][]::new);
}
/**
* Returns an array of all the types that implement the `DatabaseConnectionDetailsSPI` interface.
*
* @param refresh whether to refresh the list of types
* @return an array of all the types that implement the `DatabaseConnectionDetailsSPI` interface
*/
public static Value[] get_types(boolean refresh) {
if (refresh) {
loader.reload();
}
return loader.stream().map(provider -> provider.get().getTypeObject()).toArray(Value[]::new);
}
public Value getTypeObject() {
return EnsoMeta.getType(getModuleName(), getTypeName());
}
/** The module in which the connection details type is defined. */
protected abstract String getModuleName();

View File

@ -7,7 +7,7 @@ public class SQLServerConnectionDetailsSPI extends DatabaseConnectionDetailsSPI
@Override
protected String getModuleName() {
return "Standard.Mircosoft.SQLServer_Details";
return "Standard.Microsoft.Connection.SQLServer_Details";
}
@Override
@ -17,7 +17,7 @@ public class SQLServerConnectionDetailsSPI extends DatabaseConnectionDetailsSPI
@Override
protected String getCodeForDefaultConstructor() {
return "(SQLServer_Details.SQLServer)";
return "..SQLServer";
}
@Override

View File

@ -6,7 +6,7 @@ import org.enso.database.DatabaseConnectionDetailsSPI;
public class SnowflakeConnectionDetailsSPI extends DatabaseConnectionDetailsSPI {
@Override
protected String getModuleName() {
return "Standard.Snowflake.Snowflake_Details";
return "Standard.Snowflake.Connection.Snowflake_Details";
}
@Override
@ -16,7 +16,7 @@ public class SnowflakeConnectionDetailsSPI extends DatabaseConnectionDetailsSPI
@Override
protected String getCodeForDefaultConstructor() {
return "(Snowflake_Details.Snowflake)";
return "..Snowflake";
}
@Override

View File

@ -61,14 +61,14 @@ type SQLServer_Info_Data
get_configured_connection_details =
host = Environment.get "ENSO_SQLSERVER_HOST" if_missing="localhost"
port = Environment.get "ENSO_SQLSERVER_PORT" if_missing="1433"
port = Integer.parse (Environment.get "ENSO_SQLSERVER_PORT" if_missing="1433")
user = Environment.get "ENSO_SQLSERVER_USER" if_missing="sa"
password = Environment.get "ENSO_SQLSERVER_PASSWORD" if_missing="<YourStrong@Passw0rd>"
database = Environment.get "ENSO_SQLSERVER_DATABASE"
resolved_password = if password.starts_with "enso://" then Enso_Secret.get password else password
credentials = Credentials.Username_And_Password user resolved_password
if database.is_nothing then Nothing else
SQLServer_Details.SQLServer host port credentials database
SQLServer_Details.SQLServer host credentials port database
## Returns a function that takes anything and returns a new connection.
The function creates a _new_ connection on each invocation