mirror of
https://github.com/enso-org/enso.git
synced 2024-12-22 23:51:31 +03:00
Do not default the primary key in select_into_database_table
(#11120)
This commit is contained in:
parent
f7ae0fcf86
commit
a0c3b901ac
@ -60,6 +60,8 @@
|
|||||||
- [Add `Text.to_decimal`.][10874]
|
- [Add `Text.to_decimal`.][10874]
|
||||||
- [Added .floor, .ceil, .trunc to the in-memory `Decimal` column.][10887]
|
- [Added .floor, .ceil, .trunc to the in-memory `Decimal` column.][10887]
|
||||||
- [Added vectorized .round to the in-memory `Decimal` column.][10912]
|
- [Added vectorized .round to the in-memory `Decimal` column.][10912]
|
||||||
|
- [`select_into_database_table` no longer defaults the primary key to the first
|
||||||
|
column][11120]
|
||||||
|
|
||||||
[10614]: https://github.com/enso-org/enso/pull/10614
|
[10614]: https://github.com/enso-org/enso/pull/10614
|
||||||
[10660]: https://github.com/enso-org/enso/pull/10660
|
[10660]: https://github.com/enso-org/enso/pull/10660
|
||||||
@ -71,6 +73,7 @@
|
|||||||
[10874]: https://github.com/enso-org/enso/pull/10874
|
[10874]: https://github.com/enso-org/enso/pull/10874
|
||||||
[10887]: https://github.com/enso-org/enso/pull/10887
|
[10887]: https://github.com/enso-org/enso/pull/10887
|
||||||
[10912]: https://github.com/enso-org/enso/pull/10912
|
[10912]: https://github.com/enso-org/enso/pull/10912
|
||||||
|
[11120]: https://github.com/enso-org/enso/pull/11120
|
||||||
|
|
||||||
#### Enso Language & Runtime
|
#### Enso Language & Runtime
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ from project.Internal.Upload.Operations.Update import common_update_table
|
|||||||
rows, so errors may still occur when the output action is enabled.
|
rows, so errors may still occur when the output action is enabled.
|
||||||
@primary_key Widget_Helpers.make_column_name_vector_selector
|
@primary_key Widget_Helpers.make_column_name_vector_selector
|
||||||
DB_Table.select_into_database_table : Connection -> Text -> Vector Text | Nothing -> Boolean -> Problem_Behavior -> DB_Table ! Table_Already_Exists | Inexact_Type_Coercion | Missing_Input_Columns | Non_Unique_Key | SQL_Error | Illegal_Argument
|
DB_Table.select_into_database_table : Connection -> Text -> Vector Text | Nothing -> Boolean -> Problem_Behavior -> DB_Table ! Table_Already_Exists | Inexact_Type_Coercion | Missing_Input_Columns | Non_Unique_Key | SQL_Error | Illegal_Argument
|
||||||
DB_Table.select_into_database_table self connection (table_name : Text) primary_key=[self.columns.first.name] temporary=False on_problems:Problem_Behavior=..Report_Warning =
|
DB_Table.select_into_database_table self connection (table_name : Text) primary_key=[] temporary=False on_problems:Problem_Behavior=..Report_Warning =
|
||||||
select_into_table_implementation self connection table_name primary_key temporary on_problems
|
select_into_table_implementation self connection table_name primary_key temporary on_problems
|
||||||
|
|
||||||
## GROUP Standard.Base.Output
|
## GROUP Standard.Base.Output
|
||||||
|
@ -57,7 +57,7 @@ from project.Internal.Upload.Operations.Select_Into import select_into_table_imp
|
|||||||
rows, so errors may still occur when the output action is enabled.
|
rows, so errors may still occur when the output action is enabled.
|
||||||
@primary_key Widget_Helpers.make_column_name_vector_selector
|
@primary_key Widget_Helpers.make_column_name_vector_selector
|
||||||
Table.select_into_database_table : Connection -> Text -> Vector Text | Nothing -> Boolean -> Problem_Behavior -> DB_Table ! Table_Already_Exists | Inexact_Type_Coercion | Missing_Input_Columns | Non_Unique_Key | SQL_Error | Illegal_Argument
|
Table.select_into_database_table : Connection -> Text -> Vector Text | Nothing -> Boolean -> Problem_Behavior -> DB_Table ! Table_Already_Exists | Inexact_Type_Coercion | Missing_Input_Columns | Non_Unique_Key | SQL_Error | Illegal_Argument
|
||||||
Table.select_into_database_table self connection (table_name : Text) primary_key=[self.columns.first.name] temporary=False on_problems:Problem_Behavior=..Report_Warning =
|
Table.select_into_database_table self connection (table_name : Text) primary_key=[] temporary=False on_problems:Problem_Behavior=..Report_Warning =
|
||||||
select_into_table_implementation self connection table_name primary_key temporary on_problems
|
select_into_table_implementation self connection table_name primary_key temporary on_problems
|
||||||
|
|
||||||
## GROUP Standard.Base.Output
|
## GROUP Standard.Base.Output
|
||||||
|
@ -358,13 +358,18 @@ add_specs suite_builder setup make_new_connection persistent_connector=True =
|
|||||||
db_table_2 = t1.select_into_database_table data.connection (Name_Generator.random_name "primary-key-2")
|
db_table_2 = t1.select_into_database_table data.connection (Name_Generator.random_name "primary-key-2")
|
||||||
Panic.with_finalizer (data.connection.drop_table db_table_2.name) <|
|
Panic.with_finalizer (data.connection.drop_table db_table_2.name) <|
|
||||||
db_table_2.at "X" . to_vector . should_equal_ignoring_order [1, 2, 3]
|
db_table_2.at "X" . to_vector . should_equal_ignoring_order [1, 2, 3]
|
||||||
db_table_2.get_primary_key . should_equal ["X"]
|
db_table_2.get_primary_key . should_equal Nothing
|
||||||
|
|
||||||
db_table_3 = t1.select_into_database_table data.connection (Name_Generator.random_name "primary-key-3") primary_key=Nothing
|
db_table_3 = t1.select_into_database_table data.connection (Name_Generator.random_name "primary-key-3") primary_key=Nothing
|
||||||
Panic.with_finalizer (data.connection.drop_table db_table_3.name) <|
|
Panic.with_finalizer (data.connection.drop_table db_table_3.name) <|
|
||||||
db_table_3.at "X" . to_vector . should_equal_ignoring_order [1, 2, 3]
|
db_table_3.at "X" . to_vector . should_equal_ignoring_order [1, 2, 3]
|
||||||
db_table_3.get_primary_key . should_equal Nothing
|
db_table_3.get_primary_key . should_equal Nothing
|
||||||
|
|
||||||
|
db_table_4 = t1.select_into_database_table data.connection (Name_Generator.random_name "primary-key-4")
|
||||||
|
Panic.with_finalizer (data.connection.drop_table db_table_4.name) <|
|
||||||
|
db_table_4.at "X" . to_vector . should_equal_ignoring_order [1, 2, 3]
|
||||||
|
db_table_4.get_primary_key . should_equal Nothing
|
||||||
|
|
||||||
group_builder.specify "should ensure that primary key columns are valid" <|
|
group_builder.specify "should ensure that primary key columns are valid" <|
|
||||||
run_with_and_without_output <|
|
run_with_and_without_output <|
|
||||||
r1 = data.in_memory_table.select_into_database_table data.connection (Name_Generator.random_name "primary-key-4") primary_key=["X", "nonexistent"]
|
r1 = data.in_memory_table.select_into_database_table data.connection (Name_Generator.random_name "primary-key-4") primary_key=["X", "nonexistent"]
|
||||||
@ -381,7 +386,7 @@ add_specs suite_builder setup make_new_connection persistent_connector=True =
|
|||||||
group_builder.specify "should fail if the primary key contains nulls" <|
|
group_builder.specify "should fail if the primary key contains nulls" <|
|
||||||
t1 = Table.new [['X', [1, Nothing, 3]], ['Y', [4, 5, Nothing]]]
|
t1 = Table.new [['X', [1, Nothing, 3]], ['Y', [4, 5, Nothing]]]
|
||||||
run_with_and_without_output <|
|
run_with_and_without_output <|
|
||||||
r1 = t1.select_into_database_table data.connection (Name_Generator.random_name "primary-key-null-0") temporary=True primary_key=[]
|
r1 = t1.select_into_database_table data.connection (Name_Generator.random_name "primary-key-null-0") temporary=True
|
||||||
r1.row_count . should_equal 3
|
r1.row_count . should_equal 3
|
||||||
|
|
||||||
r2 = t1.select_into_database_table data.connection (Name_Generator.random_name "primary-key-null-1") temporary=True primary_key=['X']
|
r2 = t1.select_into_database_table data.connection (Name_Generator.random_name "primary-key-null-1") temporary=True primary_key=['X']
|
||||||
@ -564,7 +569,7 @@ add_specs suite_builder setup make_new_connection persistent_connector=True =
|
|||||||
if data.connection.dialect.dialect_flags.primary_key.allows_nulls then
|
if data.connection.dialect.dialect_flags.primary_key.allows_nulls then
|
||||||
group_builder.specify "should fail when the primary key contains nulls" <|
|
group_builder.specify "should fail when the primary key contains nulls" <|
|
||||||
t = Table.new [['X', [1, Nothing, 3]], ['Y', [4, 5, Nothing]]]
|
t = Table.new [['X', [1, Nothing, 3]], ['Y', [4, 5, Nothing]]]
|
||||||
db_table = t.select_into_database_table data.connection (Name_Generator.random_name "source-table-nulls-1") temporary=True primary_key=Nothing
|
db_table = t.select_into_database_table data.connection (Name_Generator.random_name "source-table-nulls-1") temporary=True
|
||||||
Problems.assume_no_problems db_table
|
Problems.assume_no_problems db_table
|
||||||
|
|
||||||
run_with_and_without_output <|
|
run_with_and_without_output <|
|
||||||
@ -574,11 +579,11 @@ add_specs suite_builder setup make_new_connection persistent_connector=True =
|
|||||||
if data.connection.dialect.dialect_flags.primary_key.allows_nulls.not then
|
if data.connection.dialect.dialect_flags.primary_key.allows_nulls.not then
|
||||||
group_builder.specify "should fail when the primary key contains nulls" <|
|
group_builder.specify "should fail when the primary key contains nulls" <|
|
||||||
t = Table.new [['X', [1, Nothing, 3]], ['Y', [4, 5, Nothing]]]
|
t = Table.new [['X', [1, Nothing, 3]], ['Y', [4, 5, Nothing]]]
|
||||||
db_table = t.select_into_database_table data.connection (Name_Generator.random_name "source-table-nulls-1") temporary=True primary_key=Nothing
|
db_table = t.select_into_database_table data.connection (Name_Generator.random_name "source-table-nulls-1") temporary=True
|
||||||
Problems.assume_no_problems db_table
|
Problems.assume_no_problems db_table
|
||||||
|
|
||||||
run_with_and_without_output <|
|
run_with_and_without_output <|
|
||||||
r1 = db_table.select_into_database_table data.connection (Name_Generator.random_name "primary-key-null-1") temporary=True primary_key=[]
|
r1 = db_table.select_into_database_table data.connection (Name_Generator.random_name "primary-key-null-1") temporary=True
|
||||||
r1.row_count . should_equal 3
|
r1.row_count . should_equal 3
|
||||||
|
|
||||||
r2 = db_table.select_into_database_table data.connection (Name_Generator.random_name "primary-key-null-2") temporary=True primary_key=['X']
|
r2 = db_table.select_into_database_table data.connection (Name_Generator.random_name "primary-key-null-2") temporary=True primary_key=['X']
|
||||||
|
Loading…
Reference in New Issue
Block a user