-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Saving data links to a DB_Table #11371
Merged
+592
−157
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
8e37018
(de)serialization of SQL_Statement
radeusgd 787530f
WIP saving as data link
radeusgd 86d0b9d
updating schema
radeusgd 6110c05
enable Cloud auth in Snowflake tests, to be able to test the data lin…
radeusgd cfec370
regenerate workflow after change
radeusgd fd643ca
checkpoint - interpreting datalinks, creating tables from SQL_Statement
radeusgd fb743cf
add custom tests for Postgres
radeusgd 10eed0f
add common tests for saving table/query as data link
radeusgd 7e7ac9e
simplify Postgres datalink - now one constructor with link type
radeusgd ff20d4b
parsing data link type
radeusgd 5d5e609
fix compiler errors
radeusgd 8011e7d
shorter table name, typo
radeusgd ec0d661
fixing
radeusgd 1e23ec6
fix typo
radeusgd 3e4cc58
fix
radeusgd cbd3f63
better names
radeusgd 3f1c71a
integrate Snowflake and SQLServer
radeusgd 97dbecf
add types - enable autoscoping for Case Sensitivity in Text
radeusgd b0e6bec
warn if temporary table is saved as data link
radeusgd ab02438
tests for the temp warning
radeusgd 9b58c89
fix for various temp table styles
radeusgd f1e7b0a
test and fix edge case
radeusgd 3fc114e
changelog
radeusgd e0efc3c
fix tests, more signatures
radeusgd 1400bdc
further tweaking to is_trivial_query
radeusgd cae6fd8
more tweaking
radeusgd a768c0b
fix test
radeusgd bf4b8ef
check invariants, run Snowflake on GH to have aws cli
radeusgd 5fec3c3
better encapsulation and responsibility delegation
radeusgd 15edb3a
Merge branch 'develop' into wip/radeusgd/11295-save-table-as-datalink
radeusgd 8e7d237
CR1
radeusgd 034e490
CR2
radeusgd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -267,7 +267,7 @@ Text.characters self = | |
## This matches `aBc` @ character 11 | ||
"aabbbbccccaaBcaaaa".find "a[ab]c" Case_Sensitivity.Insensitive | ||
Text.find : (Regex | Text) -> Case_Sensitivity -> Match | Nothing ! Regex_Syntax_Error | Illegal_Argument | ||
Text.find self pattern:(Regex | Text)=".*" case_sensitivity=Case_Sensitivity.Sensitive = | ||
Text.find self pattern:(Regex | Text)=".*" case_sensitivity:Case_Sensitivity=..Sensitive = | ||
case_insensitive = case_sensitivity.is_case_insensitive_in_memory | ||
compiled_pattern = Regex.compile pattern case_insensitive=case_insensitive | ||
compiled_pattern.match self | ||
|
@@ -299,8 +299,8 @@ Text.find self pattern:(Regex | Text)=".*" case_sensitivity=Case_Sensitivity.Sen | |
example_find_all_insensitive = | ||
## This matches `aABbbbc` @ character 0 and `aBC` @ character 11 | ||
"aABbbbccccaaBCaaaa".find_all "a[ab]+c" Case_Sensitivity.Insensitive | ||
Text.find_all : Text -> Case_Sensitivity -> Vector Match ! Regex_Syntax_Error | Illegal_Argument | ||
Text.find_all self pattern=".*" case_sensitivity=Case_Sensitivity.Sensitive = | ||
Text.find_all : Text|Regex -> Case_Sensitivity -> Vector Match ! Regex_Syntax_Error | Illegal_Argument | ||
Text.find_all self pattern:Text|Regex=".*" case_sensitivity:Case_Sensitivity=..Sensitive = | ||
case_insensitive = case_sensitivity.is_case_insensitive_in_memory | ||
compiled_pattern = Regex.compile pattern case_insensitive=case_insensitive | ||
compiled_pattern.match_all self | ||
|
@@ -334,8 +334,8 @@ Text.find_all self pattern=".*" case_sensitivity=Case_Sensitivity.Sensitive = | |
regex = ".+ct@.+" | ||
# Evaluates to true | ||
"[email protected]".match regex Case_Sensitivity.Insensitive | ||
Text.match : Text -> Case_Sensitivity -> Boolean ! Regex_Syntax_Error | Illegal_Argument | ||
Text.match self pattern=".*" case_sensitivity=Case_Sensitivity.Sensitive = | ||
Text.match : Text|Regex -> Case_Sensitivity -> Boolean ! Regex_Syntax_Error | Illegal_Argument | ||
Text.match self pattern:Text|Regex=".*" case_sensitivity:Case_Sensitivity=..Sensitive = | ||
case_insensitive = case_sensitivity.is_case_insensitive_in_memory | ||
compiled_pattern = Regex.compile pattern case_insensitive=case_insensitive | ||
compiled_pattern.matches self | ||
|
@@ -394,7 +394,7 @@ Text.to_regex self case_insensitive=False = Regex.compile self case_insensitive | |
'azbzczdzezfzg'.split ['b', 'zez'] == ['az', 'zczd', 'fzg'] | ||
@delimiter make_delimiter_selector | ||
Text.split : Text | Vector Text -> Case_Sensitivity -> Boolean -> Vector Text ! Illegal_Argument | ||
Text.split self delimiter="," case_sensitivity=Case_Sensitivity.Sensitive use_regex=False = | ||
Text.split self delimiter="," case_sensitivity:Case_Sensitivity=..Sensitive use_regex=False = | ||
delimiter_is_empty = case delimiter of | ||
_ : Text -> delimiter.is_empty | ||
_ : Vector -> delimiter.is_empty || delimiter.any (.is_empty) | ||
|
@@ -452,8 +452,8 @@ Text.split self delimiter="," case_sensitivity=Case_Sensitivity.Sensitive use_re | |
|
||
'Hello Big\r\nWide\tWorld\nGoodbye!' . tokenize "(\S+)(?:\s+|$)" | ||
== ["Hello","Big","Wide","World","Goodbye!"] | ||
Text.tokenize : Text -> Case_Sensitivity -> Vector Text | ||
Text.tokenize self pattern:Text=(Missing_Argument.throw "pattern") case_sensitivity:Case_Sensitivity=..Sensitive = | ||
Text.tokenize : Text|Regex -> Case_Sensitivity -> Vector Text | ||
Text.tokenize self pattern:Text|Regex=(Missing_Argument.throw "pattern") case_sensitivity:Case_Sensitivity=..Sensitive = | ||
case_insensitive = case_sensitivity.is_case_insensitive_in_memory | ||
compiled_pattern = Regex.compile pattern case_insensitive=case_insensitive | ||
compiled_pattern.tokenize self | ||
|
@@ -614,7 +614,7 @@ Cleansable_Text.from (that:Text) = Cleansable_Text.Value (pattern->replace_with- | |
|
||
"แมวมีสี่ขา".words == ['แมว', 'มี', 'สี่', 'ขา'] | ||
Text.words : Boolean -> Vector Text | ||
Text.words self keep_whitespace=False = | ||
Text.words self keep_whitespace:Boolean=False = | ||
iterator = BreakIterator.getWordInstance | ||
iterator.setText self | ||
Vector.build builder-> | ||
|
@@ -657,7 +657,7 @@ Text.words self keep_whitespace=False = | |
|
||
'\na\nb\n'.lines keep_endings=True == ['\n', 'a\n', 'b\n'] | ||
Text.lines : Boolean -> Vector Text | ||
Text.lines self keep_endings=False = | ||
Text.lines self keep_endings:Boolean=False = | ||
Vector.from_polyglot_array (Text_Utils.split_on_lines self keep_endings) | ||
|
||
## GROUP Text | ||
|
@@ -684,7 +684,7 @@ Text.lines self keep_endings=False = | |
"Hello World!".insert 5 " Cruel" == "Hello Cruel World!" | ||
"Hello World!".insert -1 " Cruel" == "Hello World! Cruel" | ||
Text.insert : Integer -> Text -> Text ! Index_Out_Of_Bounds | ||
Text.insert self index that = | ||
Text.insert self index:Integer that:Text = | ||
len = self.length | ||
idx = if index < 0 then len + index + 1 else index | ||
if (idx < 0) || (idx > len) then Error.throw (Index_Out_Of_Bounds.Error index len) else | ||
|
@@ -718,7 +718,7 @@ Text.insert self index that = | |
"A0".is_digit 1 == True | ||
"건반(Korean)".is_digit 1 == False | ||
Text.is_digit : Integer -> Boolean ! Index_Out_Of_Bounds | ||
Text.is_digit self (index=0) = | ||
Text.is_digit self index:Integer=0 = | ||
grapheme = self.at index | ||
char = (Text_Utils.get_chars grapheme).at 0 | ||
char>=48 && char<=57 | ||
|
@@ -903,7 +903,7 @@ Text.from_codepoints codepoints = Text_Utils.from_codepoints codepoints | |
"Hello!".starts_with "hello" == False | ||
"Hello!".starts_with "hello" Case_Sensitivity.Insensitive == True | ||
Text.starts_with : Text -> Case_Sensitivity -> Boolean | ||
Text.starts_with self prefix case_sensitivity=Case_Sensitivity.Sensitive = case case_sensitivity of | ||
Text.starts_with self prefix:Text case_sensitivity:Case_Sensitivity=..Sensitive = case case_sensitivity of | ||
Case_Sensitivity.Default -> self.starts_with prefix Case_Sensitivity.Sensitive | ||
Case_Sensitivity.Sensitive -> Text_Utils.starts_with self prefix | ||
Case_Sensitivity.Insensitive locale -> | ||
|
@@ -933,7 +933,7 @@ Text.starts_with self prefix case_sensitivity=Case_Sensitivity.Sensitive = case | |
"Hello World".ends_with "world" == False | ||
"Hello World".ends_with "world" Case_Sensitivity.Insensitive == True | ||
Text.ends_with : Text -> Case_Sensitivity -> Boolean | ||
Text.ends_with self suffix case_sensitivity=Case_Sensitivity.Sensitive = case case_sensitivity of | ||
Text.ends_with self suffix:Text case_sensitivity:Case_Sensitivity=..Sensitive = case case_sensitivity of | ||
Case_Sensitivity.Default -> self.ends_with suffix Case_Sensitivity.Sensitive | ||
Case_Sensitivity.Sensitive -> Text_Utils.ends_with self suffix | ||
Case_Sensitivity.Insensitive locale -> | ||
|
@@ -979,7 +979,7 @@ Text.ends_with self suffix case_sensitivity=Case_Sensitivity.Sensitive = case ca | |
|
||
"Hello!".contains "LO" Case_Sensitivity.Insensitive | ||
Text.contains : Text -> Case_Sensitivity -> Boolean | ||
Text.contains self term="" case_sensitivity=Case_Sensitivity.Sensitive = case case_sensitivity of | ||
Text.contains self term:Text="" case_sensitivity:Case_Sensitivity=..Sensitive = case case_sensitivity of | ||
Case_Sensitivity.Default -> self.contains term Case_Sensitivity.Sensitive | ||
Case_Sensitivity.Sensitive -> Text_Utils.contains self term | ||
Case_Sensitivity.Insensitive locale -> | ||
|
@@ -1004,7 +1004,7 @@ Text.contains self term="" case_sensitivity=Case_Sensitivity.Sensitive = case ca | |
|
||
"Hello " * 2 == "Hello Hello " | ||
Text.* : Integer -> Text | ||
Text.* self count = self.repeat count | ||
Text.* self count:Integer = self.repeat count | ||
|
||
## GROUP Calculations | ||
ICON text | ||
|
@@ -1025,7 +1025,7 @@ Text.* self count = self.repeat count | |
|
||
"Hello ".repeat 2 == "Hello Hello " | ||
Text.repeat : Integer -> Text | ||
Text.repeat self count=1 = | ||
Text.repeat self count:Integer=1 = | ||
0.up_to count . fold "" acc-> _-> acc + self | ||
|
||
## ALIAS first, head, keep, last, left, limit, mid, right, slice, substring, tail, top | ||
|
@@ -1343,7 +1343,7 @@ Text.trim self where:Location=..Both what=_.is_whitespace = | |
match_1 == match_2 | ||
|
||
Text.locate : Text -> Matching_Mode -> Case_Sensitivity -> Span | Nothing | ||
Text.locate self term="" mode=Matching_Mode.First case_sensitivity=Case_Sensitivity.Sensitive = case case_sensitivity of | ||
Text.locate self term:Text="" mode=Matching_Mode.First case_sensitivity:Case_Sensitivity=..Sensitive = case case_sensitivity of | ||
Case_Sensitivity.Default -> self.locate term mode Case_Sensitivity.Sensitive | ||
Case_Sensitivity.Sensitive -> | ||
codepoint_span = case mode of | ||
|
@@ -1434,7 +1434,7 @@ Text.locate self term="" mode=Matching_Mode.First case_sensitivity=Case_Sensitiv | |
match_2 = ligatures . locate_all "ffiff" case_sensitivity=Case_Sensitive.Insensitive | ||
match_2 . map .length == [2, 5] | ||
Text.locate_all : Text -> Case_Sensitivity -> Vector Span | ||
Text.locate_all self term="" case_sensitivity=Case_Sensitivity.Sensitive = if term.is_empty then Vector.new (self.length + 1) (ix -> Span.Value (ix.up_to ix) self) else case case_sensitivity of | ||
Text.locate_all self term:Text="" case_sensitivity:Case_Sensitivity=..Sensitive = if term.is_empty then Vector.new (self.length + 1) (ix -> Span.Value (ix.up_to ix) self) else case case_sensitivity of | ||
Case_Sensitivity.Default -> self.locate term Case_Sensitivity.Sensitive | ||
Case_Sensitivity.Sensitive -> | ||
codepoint_spans = Vector.from_polyglot_array <| Text_Utils.span_of_all self term | ||
|
@@ -1479,7 +1479,7 @@ Text.locate_all self term="" case_sensitivity=Case_Sensitivity.Sensitive = if te | |
"Hello World!".index_of "J" == Nothing | ||
"Hello World!".index_of "o" == 4 | ||
Text.index_of : Text -> Integer -> Case_Sensitivity -> Integer | Nothing | ||
Text.index_of self term="" (start : Integer = 0) case_sensitivity=Case_Sensitivity.Sensitive = | ||
Text.index_of self term:Text="" (start : Integer = 0) case_sensitivity:Case_Sensitivity=..Sensitive = | ||
used_start = if start < 0 then start+self.length else start | ||
if used_start < 0 || used_start > self.length then Error.throw (Index_Out_Of_Bounds.Error start self.length+1) else | ||
used = if used_start == 0 then self else self.drop used_start | ||
|
@@ -1514,7 +1514,7 @@ Text.index_of self term="" (start : Integer = 0) case_sensitivity=Case_Sensitivi | |
"Hello World!".last_index_of "J" == Nothing | ||
"Hello World!".last_index_of "o" == 7 | ||
Text.last_index_of : Text -> Integer -> Case_Sensitivity -> Integer | Nothing | ||
Text.last_index_of self term="" start=-1 case_sensitivity=Case_Sensitivity.Sensitive = | ||
Text.last_index_of self term:Text="" start=-1 case_sensitivity:Case_Sensitivity=..Sensitive = | ||
used_start = if start < 0 then start+self.length else start | ||
if used_start < 0 || used_start >= self.length then Error.throw (Index_Out_Of_Bounds.Error start self.length) else | ||
used = if used_start == self.length-1 then self else self.take used_start+1 | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should get rid of use_regex and take Regex or Text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like an out of scope change for this PR IMHO. Maybe I shouldn't have started the type changes at all - but I just wanted to do the trivial ones and thought they could be done 'in the meantime'.
But this requires logical changes and changes to the tests, I'd prefer to do it separately.