diff --git a/distribution/lib/Standard/Database/0.0.0-dev/src/Connection/Connection.enso b/distribution/lib/Standard/Database/0.0.0-dev/src/Connection/Connection.enso index c05b9c478f28f..09f289092b5b9 100644 --- a/distribution/lib/Standard/Database/0.0.0-dev/src/Connection/Connection.enso +++ b/distribution/lib/Standard/Database/0.0.0-dev/src/Connection/Connection.enso @@ -120,7 +120,7 @@ type Connection @types make_table_types_selector @schema make_schema_selector tables : Text -> Text -> Text -> Vector -> Boolean -> Materialized_Table - tables self name_like=Nothing database=self.database schema=Nothing types=default_table_types all_fields=False = + tables self name_like=Nothing database=self.database schema=Nothing types=self.dialect.default_table_types all_fields=False = types_array = if types.is_nothing then Nothing else types.to_array name_map = Map.from_vector [["TABLE_CAT", "Database"], ["TABLE_SCHEM", "Schema"], ["TABLE_NAME", "Name"], ["TABLE_TYPE", "Type"], ["REMARKS", "Description"], ["TYPE_CAT", "Type Database"], ["TYPE_SCHEM", "Type Schema"], ["TYPE_NAME", "Type Name"]] self.jdbc_connection.with_metadata metadata-> @@ -235,11 +235,6 @@ type Connection drop_table self table_name = self.execute_update (self.dialect.generate_sql (Query.Drop_Table table_name)) -## ADVANCED - The default types we want to include in `tables`. -default_table_types = - ["TABLE", "VIEW", "TEMPORARY TABLE", "TEMPORARY VIEW", "MATERIALIZED VIEW", "FOREIGN TABLE", "PARTITIONED TABLE", "GLOBAL TEMPORARY"] - ## PRIVATE make_table_types_selector connection = Single_Choice values=(connection.table_types.map t-> Option t t.pretty) @@ -251,7 +246,7 @@ make_schema_selector connection = ## PRIVATE all_known_table_names connection = - tables = connection.tables name_like=Nothing database=connection.database schema=Nothing types=default_table_types all_fields=False + tables = connection.tables name_like=Nothing database=connection.database schema=Nothing types=Nothing all_fields=False tables.at "Name" . to_vector ## PRIVATE diff --git a/distribution/lib/Standard/Database/0.0.0-dev/src/Data/Dialect.enso b/distribution/lib/Standard/Database/0.0.0-dev/src/Data/Dialect.enso index 7f278986aa4a1..00bd7fe3cb539 100644 --- a/distribution/lib/Standard/Database/0.0.0-dev/src/Data/Dialect.enso +++ b/distribution/lib/Standard/Database/0.0.0-dev/src/Data/Dialect.enso @@ -187,6 +187,12 @@ type Dialect _ = operation Unimplemented.throw "This is an interface only." + ## PRIVATE + The default table types to use when listing tables. + default_table_types : Vector Text + default_table_types self = + Unimplemented.throw "This is an interface only." + ## PRIVATE The dialect of SQLite databases. diff --git a/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/Postgres/Postgres_Connection.enso b/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/Postgres/Postgres_Connection.enso index 6c6e754a845ad..3c21c341e2771 100644 --- a/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/Postgres/Postgres_Connection.enso +++ b/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/Postgres/Postgres_Connection.enso @@ -17,7 +17,7 @@ import project.Internal.IR.Query.Query import project.Internal.JDBC_Connection import project.Internal.SQL_Type_Reference.SQL_Type_Reference -from project.Connection.Connection import default_table_types, make_table_types_selector, make_schema_selector, make_table_name_selector +from project.Connection.Connection import make_table_types_selector, make_schema_selector, make_table_name_selector from project.Errors import SQL_Error from project.Internal.Result_Set import read_column @@ -102,7 +102,7 @@ type Postgres_Connection @types make_table_types_selector @schema make_schema_selector tables : Text -> Text -> Text -> Vector -> Boolean -> Materialized_Table - tables self name_like=Nothing database=self.database schema=Nothing types=default_table_types all_fields=False = + 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 ## Set up a query returning a Table object, which can be used to work with data within the database or load it into memory. diff --git a/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/Postgres/Postgres_Dialect.enso b/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/Postgres/Postgres_Dialect.enso index 3d6f5fcc0c17a..9579eb6463c9f 100644 --- a/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/Postgres/Postgres_Dialect.enso +++ b/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/Postgres/Postgres_Dialect.enso @@ -199,6 +199,11 @@ type Postgres_Dialect is_supported self operation = self.internal_generator_dialect.is_supported operation + ## PRIVATE + The default table types to use when listing tables. + default_table_types : Vector Text + default_table_types self = + ["TABLE", "VIEW", "TEMPORARY TABLE", "TEMPORARY VIEW", "MATERIALIZED VIEW", "FOREIGN TABLE", "PARTITIONED TABLE"] ## PRIVATE make_internal_generator_dialect = diff --git a/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/Redshift/Redshift_Dialect.enso b/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/Redshift/Redshift_Dialect.enso index c673f7e61cbc9..80b1230c8f3d0 100644 --- a/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/Redshift/Redshift_Dialect.enso +++ b/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/Redshift/Redshift_Dialect.enso @@ -146,3 +146,9 @@ type Redshift_Dialect is_supported : Text -> Boolean is_supported self operation = self.internal_generator_dialect.is_supported operation + + ## PRIVATE + The default table types to use when listing tables. + default_table_types : Vector Text + default_table_types self = + ["TABLE", "VIEW", "TEMPORARY TABLE", "TEMPORARY VIEW", "MATERIALIZED VIEW", "FOREIGN TABLE", "PARTITIONED TABLE"] diff --git a/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/SQLite/SQLite_Connection.enso b/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/SQLite/SQLite_Connection.enso index 490df029adfc3..c10f17d79939d 100644 --- a/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/SQLite/SQLite_Connection.enso +++ b/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/SQLite/SQLite_Connection.enso @@ -17,7 +17,7 @@ import project.Internal.IR.Query.Query import project.Internal.JDBC_Connection import project.Internal.SQL_Type_Reference.SQL_Type_Reference -from project.Connection.Connection import default_table_types, make_table_types_selector, make_schema_selector, make_table_name_selector +from project.Connection.Connection import make_table_types_selector, make_schema_selector, make_table_name_selector from project.Errors import SQL_Error type SQLite_Connection @@ -96,7 +96,7 @@ type SQLite_Connection @types make_table_types_selector @schema make_schema_selector tables : Text -> Text -> Text -> Vector -> Boolean -> Materialized_Table - tables self name_like=Nothing database=self.database schema=Nothing types=default_table_types all_fields=False = + 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 ## Set up a query returning a Table object, which can be used to work with data within the database or load it into memory. diff --git a/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/SQLite/SQLite_Dialect.enso b/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/SQLite/SQLite_Dialect.enso index a0e00b421b4de..aa8fd0d670587 100644 --- a/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/SQLite/SQLite_Dialect.enso +++ b/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/SQLite/SQLite_Dialect.enso @@ -207,6 +207,12 @@ type SQLite_Dialect is_supported self operation = self.internal_generator_dialect.is_supported operation + ## PRIVATE + The default table types to use when listing tables. + default_table_types : Vector Text + default_table_types self = + ["TABLE", "VIEW", "GLOBAL TEMPORARY"] + ## PRIVATE make_internal_generator_dialect =