Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
275 commits
Select commit Hold shift + click to select a range
f4adfff
Merge branch 'dev/agarwalayush/AuthZForNestedInsertions' of https://g…
ayush3797 Jan 13, 2024
797db23
Moving role extraction logic to authz resolver
ayush3797 Jan 14, 2024
02fdfdc
Adding comments/examples
ayush3797 Jan 14, 2024
f225e10
updating comments
ayush3797 Jan 14, 2024
5dca094
using tryadd
ayush3797 Jan 14, 2024
887dd79
format fix
ayush3797 Jan 14, 2024
82b0c7f
Fixing failures due to tests
ayush3797 Jan 15, 2024
33fca99
fixing format
ayush3797 Jan 15, 2024
2073c48
Moving linking entity logic to sqlmetadataprovider
ayush3797 Jan 15, 2024
2c96a8b
fixing typo
ayush3797 Jan 15, 2024
fe05132
Moving linking entity logic to sqlmdpvdr
ayush3797 Jan 16, 2024
11bb3d4
fixing format
ayush3797 Jan 16, 2024
d6f6949
fixing failures
ayush3797 Jan 16, 2024
1c0ce60
Preventing serialisation/deserialization of islinkingentity property
ayush3797 Jan 17, 2024
cba8072
Fixing dwsql
ayush3797 Jan 17, 2024
162f2de
god please fix this formatting error
ayush3797 Jan 17, 2024
e9d8b8e
fixing tests
ayush3797 Jan 17, 2024
c58f3ea
Refining logic to create linking objects
ayush3797 Jan 17, 2024
613f386
refining code
ayush3797 Jan 17, 2024
6757208
refactor schema converter for clear code
ayush3797 Jan 17, 2024
9e4b732
adding/removing comments
ayush3797 Jan 17, 2024
f133f1f
resolving merge conflicts
severussundar Jan 22, 2024
c53f4ce
nits
ayush3797 Jan 24, 2024
a07f567
adds sequential logic for query execution, adds logic for multiple in…
severussundar Jan 24, 2024
87d8b2c
adds logic for resolving selection set
severussundar Jan 29, 2024
ff3e952
Merge with main
ayush3797 Jan 29, 2024
450da35
update branch
ayush3797 Jan 29, 2024
8b6e365
adds logic for selection set resolution
severussundar Jan 30, 2024
3e4aae4
fix formatting
severussundar Jan 30, 2024
076d0b2
removes unused model class
severussundar Jan 30, 2024
7a503d6
Addressing review
ayush3797 Feb 1, 2024
27a45c1
addressing review
ayush3797 Feb 1, 2024
baa0bb8
adding param name
ayush3797 Feb 2, 2024
f5237fe
Logic to find names of src/target entities from linking entity name
ayush3797 Feb 2, 2024
e963d40
update comment
ayush3797 Feb 2, 2024
80a7e79
addressing comments
ayush3797 Feb 4, 2024
143624a
updates HC input parsing logic
severussundar Feb 5, 2024
ea99a9c
fixes complex policy scenario
severussundar Feb 5, 2024
61ec896
adds descriptions to fields
severussundar Feb 6, 2024
af60e25
updating branch
ayush3797 Feb 6, 2024
2007b3e
updating branch
ayush3797 Feb 6, 2024
09055ab
fixing bug
ayush3797 Feb 6, 2024
9262b36
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Feb 6, 2024
e850ead
Adding validation to disallow multiple relationships between same sou…
ayush3797 Feb 9, 2024
3b824d6
adding summary/reusing existing methods
ayush3797 Feb 12, 2024
29c2a1a
Initial progress
ayush3797 Feb 14, 2024
422630d
initial prgress
ayush3797 Feb 14, 2024
47def99
saving progress for fk directive
ayush3797 Feb 14, 2024
783464c
Logic to add FK directive for custom relationships
ayush3797 Feb 15, 2024
9cb61d6
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Feb 15, 2024
d68d311
separating naming logic for mutations
ayush3797 Feb 15, 2024
68b780c
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Feb 15, 2024
be7831f
making rel fields nullable
ayush3797 Feb 15, 2024
daeae37
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Feb 15, 2024
4142fd9
Merge branch 'main' into dev/NestedMutations
severussundar Feb 15, 2024
a5f3654
adding tests
ayush3797 Feb 15, 2024
b63aed6
nit
ayush3797 Feb 15, 2024
8583106
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Feb 15, 2024
5089f90
Adding test summaries
ayush3797 Feb 15, 2024
97e6878
refactoring test
ayush3797 Feb 15, 2024
d345a5f
updating comment
ayush3797 Feb 15, 2024
2e03f43
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Feb 15, 2024
9625095
rearranging code
ayush3797 Feb 15, 2024
f4743de
updating branch
ayush3797 Feb 15, 2024
4c7cb74
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Feb 15, 2024
fbd9001
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Feb 15, 2024
ce0c49f
Merge branch 'dev/NestedMutations' into dev/agarwalayush/schemaGenera…
ayush3797 Feb 15, 2024
baa0956
starting tests
ayush3797 Feb 15, 2024
ce8cc98
Adding test
ayush3797 Feb 15, 2024
adcdeab
reverting exception throwing on multiple relationships between same e…
ayush3797 Feb 16, 2024
6453ed5
addressing review
ayush3797 Feb 19, 2024
c44dda9
addressing review
ayush3797 Feb 19, 2024
7820551
Merge branch 'dev/agarwalayush/schemaGenerationTests' into dev/agarwa…
ayush3797 Feb 20, 2024
6b2f055
reverting conn string change
ayush3797 Feb 20, 2024
a9bb393
addressing review
ayush3797 Feb 22, 2024
be28782
addressing review
ayush3797 Feb 22, 2024
60ae0af
adding comment
ayush3797 Feb 22, 2024
55912f4
adding comment
ayush3797 Feb 22, 2024
ee30cdb
Order helper class for nested insertions
ayush3797 Feb 22, 2024
ad0d0f7
resolving conflicts
ayush3797 Feb 22, 2024
6827c9f
Merge branch 'dev/agarwalayush/AuthZForNestedInsertions' into dev/aga…
ayush3797 Feb 22, 2024
8e35c5b
Merge branch 'main' into dev/NestedMutations
severussundar Feb 23, 2024
effc380
addressing comments
ayush3797 Feb 27, 2024
adfcab9
updating mton function logic
ayush3797 Feb 27, 2024
9e377c3
refining logic
ayush3797 Feb 27, 2024
8db211c
addressing review
ayush3797 Feb 28, 2024
5ca4171
addressing review
ayush3797 Feb 28, 2024
a6ae8aa
Adding test asserting absence of ref field directive on non-ref columns
ayush3797 Feb 28, 2024
02c79bc
renaming set
ayush3797 Feb 29, 2024
7624675
formatting fix
ayush3797 Feb 29, 2024
559025f
formatting fix
ayush3797 Feb 29, 2024
78c8f7b
Merge branch 'dev/NestedMutations' into dev/agarwalayush/schemaGenera…
ayush3797 Feb 29, 2024
96c4a36
formatting fix
ayush3797 Feb 29, 2024
0c4fc3d
Refactoring cosmos create input generation into a different methof
ayush3797 Feb 29, 2024
fa9bcab
fixing test setup
ayush3797 Feb 29, 2024
e0a2b92
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Feb 29, 2024
69cc7ce
Merge branch 'dev/agarwalayush/AuthZForNestedInsertions' into dev/aga…
ayush3797 Feb 29, 2024
207d114
Addressing review
ayush3797 Feb 29, 2024
957058a
nit
ayush3797 Feb 29, 2024
328e8ee
Adding test class
ayush3797 Feb 29, 2024
c308d50
starting tests
ayush3797 Feb 29, 2024
694fead
adding test IP
ayush3797 Feb 29, 2024
2d2fc79
Adding unit tests for referencing entity determination based on metadata
ayush3797 Feb 29, 2024
449908f
Adding similar tests to Pg/MySql
ayush3797 Feb 29, 2024
8e269a9
Identifying more invalid cases
ayush3797 Feb 29, 2024
95ff1b1
nits
ayush3797 Feb 29, 2024
f008c24
addressing review/adding comments
ayush3797 Mar 5, 2024
fac35d3
adding example
ayush3797 Mar 5, 2024
5763a11
Addressing review
ayush3797 Mar 5, 2024
d94c265
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Mar 5, 2024
7d95cab
fixing bug
ayush3797 Mar 5, 2024
35e895a
Adding test for determining order in custom relationships
ayush3797 Mar 5, 2024
9e441c7
Merge branch 'main' into dev/NestedMutations
severussundar Mar 6, 2024
04fbfae
Merge branch 'main' into dev/NestedMutations
severussundar Mar 11, 2024
f7bc95d
Feature Flag for Nested Mutations: CLI changes (#1983)
severussundar Mar 12, 2024
db967d5
Merge branch 'main' into dev/NestedMutations
severussundar Mar 13, 2024
b34c9f1
Addressing review
ayush3797 Mar 13, 2024
cb7d185
removing stale logic code
ayush3797 Mar 13, 2024
6eea6b0
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Mar 13, 2024
2ef2ac6
Merge branch 'dev/agarwalayush/AuthZForNestedInsertions' into dev/aga…
ayush3797 Mar 13, 2024
70ce608
Adding tests
ayush3797 Mar 13, 2024
cb67327
mering latest schema gen changes
severussundar Mar 14, 2024
fd3dfb9
merge latest authz changes
severussundar Mar 14, 2024
428114f
merge order determination latest changes
severussundar Mar 14, 2024
27c6a23
updating exception msgs
ayush3797 Mar 18, 2024
52f28bb
Updating tests
ayush3797 Mar 18, 2024
c9f1d7c
updating config
ayush3797 Mar 18, 2024
76b851b
updating mssql config generator
ayush3797 Mar 19, 2024
89522f0
Adding tests to pgsql
ayush3797 Mar 19, 2024
c3615d1
tests for mysql
ayush3797 Mar 19, 2024
b44463c
updating verfied config for mysql
ayush3797 Mar 19, 2024
58ae7c6
updating test category
ayush3797 Mar 19, 2024
de9d6ea
Adding tests
ayush3797 Mar 19, 2024
e622a7e
Adding tests
ayush3797 Mar 19, 2024
f9c30f6
Updating config
ayush3797 Mar 19, 2024
b1d5aca
Rename nested-mutations and nested-create to multiple-mutations and m…
severussundar Mar 20, 2024
ad40fb2
format
seantleonard Mar 20, 2024
12acb29
Merge branch 'main' into dev/NestedMutations
ayush3797 Mar 21, 2024
09b8d98
Merge branch 'dev/NestedMutations' into dev/agarwalayush/schemaGenera…
ayush3797 Mar 21, 2024
32e6fe9
Merge branch 'dev/NestedMutations' of https://github.com/Azure/data-a…
ayush3797 Mar 21, 2024
75534f1
Merge branch 'dev/NestedMutations' into dev/agarwalayush/schemaGenera…
ayush3797 Mar 21, 2024
0ca28f1
updating branch
ayush3797 Mar 21, 2024
cecc1de
Removing duplicate entities
ayush3797 Mar 21, 2024
d0801b7
updating used entities
ayush3797 Mar 21, 2024
549f427
updating mysql entities
ayush3797 Mar 21, 2024
a104573
updating for pg
ayush3797 Mar 21, 2024
7b28340
updating for pg
ayush3797 Mar 21, 2024
3bf3ae0
merge latest changes from schema gen
severussundar Mar 21, 2024
7d19860
Merge branch 'dev/agarwalayush/nestedInsertionOrderHelper' into dev/s…
severussundar Mar 21, 2024
104248b
fixing failures
ayush3797 Mar 21, 2024
9d7441b
minor refactors
severussundar Mar 21, 2024
eb3238b
cleaning up test
ayush3797 Mar 21, 2024
658b22f
Fixing dwsql failure
ayush3797 Mar 21, 2024
b8872a7
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Mar 21, 2024
0ad5561
formatting fix
ayush3797 Mar 21, 2024
e2f9418
Multiple-create: Schema generation (#1902)
ayush3797 Mar 21, 2024
e34cf14
Merge branch 'dev/NestedMutations' into dev/agarwalayush/schemaGenera…
ayush3797 Mar 21, 2024
be3c31b
Merge branch 'dev/agarwalayush/schemaGeneration' into dev/agarwalayus…
ayush3797 Mar 21, 2024
147043b
Moving failing negative unit tests to integration testss
ayush3797 Mar 21, 2024
a7d36a0
Merge branch 'dev/agarwalayush/AuthZForNestedInsertions' into dev/aga…
ayush3797 Mar 21, 2024
0a3b3aa
Formatting fix
ayush3797 Mar 21, 2024
7a6b6b1
Formatting fix
ayush3797 Mar 21, 2024
e777c8a
fixing test
ayush3797 Mar 21, 2024
033a82b
Merge branch 'main' into dev/NestedMutations
ayush3797 Mar 21, 2024
cd601a1
Merge branch 'dev/agarwalayush/AuthZForNestedInsertions' into dev/shy…
severussundar Mar 21, 2024
caeabf8
Merge branch 'dev/agarwalayush/nestedInsertionOrderHelper' into dev/s…
severussundar Mar 21, 2024
9a8e805
Added more tests
ayush3797 Mar 21, 2024
0e9eb1e
updating config gen
ayush3797 Mar 21, 2024
f3efbf0
Merge branch 'dev/agarwalayush/AuthZForNestedInsertions' into dev/aga…
ayush3797 Mar 21, 2024
9233c41
Multiple-create: Authorization (#1943)
ayush3797 Mar 21, 2024
6451db8
Merge branch 'dev/NestedMutations' into dev/agarwalayush/nestedInsert…
ayush3797 Mar 21, 2024
f1b19ba
Removing duplicate roles
ayush3797 Mar 21, 2024
68839c9
update branch
ayush3797 Mar 21, 2024
fecfa62
Merge branch 'dev/agarwalayush/nestedInsertionOrderHelper' into dev/s…
severussundar Mar 25, 2024
45d7a5f
pulling latest changes from related branches
severussundar Mar 25, 2024
4246354
add debugger displaynames to objects in DatabaseObject.cs classes to …
seantleonard Mar 25, 2024
9a90ca1
Enable or Disable Multiple Create operation based on feature flag val…
severussundar Mar 26, 2024
d08001c
merge latest changes from main
severussundar Mar 26, 2024
75b06c0
adds logic to throw exp when source is null; got missed during merge …
severussundar Mar 26, 2024
9a54f5d
Merge branch 'main' into dev/NestedMutations
severussundar Mar 27, 2024
b866883
Addressing review
ayush3797 Mar 27, 2024
3c335e5
Merge branch 'dev/agarwalayush/nestedInsertionOrderHelper' into dev/s…
severussundar Mar 27, 2024
eba4778
merging latest changes from dev/NestedMutations
severussundar Mar 27, 2024
0de3e1a
updating cmt
ayush3797 Mar 27, 2024
d311e09
updating branch
ayush3797 Mar 28, 2024
25a8bd8
adds logic to accomodate relationship only through config file
severussundar Mar 28, 2024
0d9a55d
renames vars, adds comments
severussundar Mar 28, 2024
d03b3e7
Merge branch 'main' into dev/NestedMutations
severussundar Mar 28, 2024
8a1e61a
Merge branch 'dev/agarwalayush/nestedInsertionOrderHelper' into dev/s…
severussundar Mar 28, 2024
c4edd45
merge latest changes from dev/NestedMutations
severussundar Mar 28, 2024
abf1259
enables multiple create feature for tests
severussundar Mar 28, 2024
266f0f6
merging latest changes from main
severussundar Mar 30, 2024
5301d46
enables new flow when multiple create enabled, adds new method for fo…
severussundar Mar 30, 2024
95612b3
fix formatting
severussundar Mar 30, 2024
60c7972
accounts for mappings
severussundar Mar 31, 2024
7b0b4da
updates logic for optional fields, uses latest logic to prepare db co…
severussundar Mar 31, 2024
5bc44e8
Merge branch 'main' into dev/shyamsundarj/nested-inserts-db-query-gen…
severussundar Apr 1, 2024
b780527
adds multiple create integration tests
severussundar Apr 2, 2024
33c0bf8
merging latest changes from main
severussundar Apr 2, 2024
a749f7d
fixing failing tests as a side of effect of changing db schema
severussundar Apr 2, 2024
11f13f0
resolving merge conflicts from main
severussundar Apr 2, 2024
a9c780d
addressing review comments
severussundar Apr 2, 2024
cab2a90
Merge branch 'main' into dev/shyamsundarj/nested-inserts-db-query-gen…
severussundar Apr 4, 2024
569efa7
adds tests for relationship defined only through config file
severussundar Apr 8, 2024
5dc7717
fixing tests, unignoring ignored tests
severussundar Apr 8, 2024
df709c5
Merge branch 'main' into dev/shyamsundarj/nested-inserts-db-query-gen…
severussundar Apr 9, 2024
8fc49a7
fixing tests
severussundar Apr 9, 2024
838af53
Merge branch 'dev/shyamsundarj/nested-inserts-db-query-generation' of…
severussundar Apr 9, 2024
d6de41c
Merge branch 'main' into dev/agarwalayush/nestedInsertionOrderHelper
ayush3797 Apr 9, 2024
a9a9e4a
addressing review comments
severussundar Apr 10, 2024
5f92590
fix formatting
severussundar Apr 10, 2024
914289c
update exception msg
severussundar Apr 10, 2024
c16978f
adds linking table validations
severussundar Apr 12, 2024
6f4da03
Merge branch 'main' into dev/shyamsundarj/nested-inserts-db-query-gen…
severussundar Apr 12, 2024
bc96a95
adds helper method for fk population, adds helpful comments
severussundar Apr 12, 2024
70cc854
renames ReferencingEntities/ReferencedEntities to ReferencingRelation…
severussundar Apr 12, 2024
df6aa6c
updates logic to populate fks, removes defensive code checks, removes…
severussundar Apr 14, 2024
6baddd8
re-writes logic to remove higherLevelEntityPK from MultipleCreateStru…
severussundar Apr 14, 2024
6af3f54
adds test for 1:1 relationship
severussundar Apr 14, 2024
d4b269c
updates method summary
severussundar Apr 14, 2024
c480536
Merge branch 'dev/agarwalayush/nestedInsertionOrderHelper' into dev/s…
severussundar Apr 15, 2024
eee77de
renames CurrentEntityPKs to CurrentEntityCreatedValues
severussundar Apr 15, 2024
c83fec9
incorporating review feedback
severussundar Apr 16, 2024
62c9894
removes redundant check
severussundar Apr 16, 2024
8fb1a62
moves query execution logic to helper function
severussundar Apr 16, 2024
ae13eab
adds logic to fetch valid fkdefinition
severussundar Apr 16, 2024
c47dd23
Merge branch 'main' into dev/shyamsundarj/nested-inserts-db-query-gen…
severussundar Apr 17, 2024
89898a1
addressing review
severussundar Apr 17, 2024
8e17717
re-uses TryGetFkDefinitions, uses TryGetExposedFieldToBackingFieldMap
severussundar Apr 17, 2024
0787a9a
throws exp when pk value is null, re-organizes policy tests
severussundar Apr 17, 2024
2b1f0c4
some cosmetic changes
severussundar Apr 17, 2024
c859289
adds nesting level to exception msg
severussundar Apr 17, 2024
9020843
Merge branch 'main' into dev/shyamsundarj/nested-inserts-db-query-gen…
severussundar Apr 23, 2024
0ba1578
Merge branch 'main' into dev/shyamsundarj/nested-inserts-db-query-gen…
severussundar Apr 23, 2024
cbc5f2e
Merge branch 'main' into dev/shyamsundarj/nested-inserts-db-query-gen…
seantleonard Apr 24, 2024
24c69e9
incorporating review feedback
severussundar Apr 24, 2024
1d8e519
Merge branch 'main' into dev/shyamsundarj/nested-inserts-db-query-gen…
severussundar Apr 24, 2024
e7184e3
Merge branch 'main' into dev/shyamsundarj/nested-inserts-db-query-gen…
severussundar Apr 25, 2024
d41e3ee
improves comments for multiple mutation tests
severussundar Apr 25, 2024
4a40670
renames HigherLevelEntityName -> ParentEntityName
severussundar Apr 25, 2024
f40a43e
adds helpful comments about new sqlquerystructure ctor
severussundar Apr 25, 2024
88b18c6
incorporates suggestions
severussundar Apr 25, 2024
247fe00
renames methods, variables; updates comments
severussundar Apr 25, 2024
5fae197
removes redundant param from PopulateCurrentAndLinkingEntityParams()
severussundar Apr 25, 2024
4f360e2
Merge branch 'main' into dev/shyamsundarj/nested-inserts-db-query-gen…
severussundar Apr 25, 2024
cfd0e6d
unignoring test, adds more details in test summary
severussundar Apr 26, 2024
e13165a
uses contextual var names, renames function name
severussundar Apr 26, 2024
1023343
adds comments, renames vars in parsing functions
severussundar Apr 26, 2024
cb86b90
maintains state in sqlquerystructure
severussundar Apr 26, 2024
b1f4adb
updates param summary
severussundar Apr 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions config-generators/mssql-commands.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
init --config "dab-config.MsSql.json" --database-type mssql --set-session-context true --connection-string "Server=tcp:127.0.0.1,1433;Persist Security Info=False;User ID=sa;Password=REPLACEME;MultipleActiveResultSets=False;Connection Timeout=5;" --host-mode Development --cors-origin "http://localhost:5000" --graphql.multiple-create.enabled true
add Publisher --config "dab-config.MsSql.json" --source publishers --permissions "anonymous:read"
add Publisher_MM --config "dab-config.MsSql.json" --source publishers_mm --graphql "Publisher_MM:Publishers_MM" --permissions "anonymous:*"
add Stock --config "dab-config.MsSql.json" --source stocks --permissions "anonymous:create,read,update,delete"
add Book --config "dab-config.MsSql.json" --source books --permissions "anonymous:create,read,update,delete" --graphql "book:books"
add Book_MM --config "dab-config.MsSql.json" --source books_mm --permissions "anonymous:*" --graphql "book_mm:books_mm"
add BookWebsitePlacement --config "dab-config.MsSql.json" --source book_website_placements --permissions "anonymous:read"
add Author --config "dab-config.MsSql.json" --source authors --permissions "anonymous:read"
add Author_MM --config "dab-config.MsSql.json" --source authors_mm --graphql "author_mm:authors_mm" --permissions "anonymous:*"
add Revenue --config "dab-config.MsSql.json" --source revenues --permissions "anonymous:*"
add Review --config "dab-config.MsSql.json" --source reviews --permissions "anonymous:create,read,update" --rest true --graphql "review:reviews"
add Review_MM --config "dab-config.MsSql.json" --source reviews_mm --permissions "anonymous:*" --rest true --graphql "review_mm:reviews_mm"
add Comic --config "dab-config.MsSql.json" --source comics --permissions "anonymous:create,read,update"
add Broker --config "dab-config.MsSql.json" --source brokers --permissions "anonymous:read"
add WebsiteUser --config "dab-config.MsSql.json" --source website_users --permissions "anonymous:create,read,delete,update"
add WebsiteUser_MM --config "dab-config.MsSql.json" --source website_users_mm --graphql "websiteuser_mm:websiteusers_mm" --permissions "anonymous:*"
add SupportedType --config "dab-config.MsSql.json" --source type_table --permissions "anonymous:create,read,delete,update"
add stocks_price --config "dab-config.MsSql.json" --source stocks_price --permissions "authenticated:create,read,update,delete"
update stocks_price --config "dab-config.MsSql.json" --permissions "anonymous:read"
Expand Down Expand Up @@ -71,6 +76,9 @@ update Publisher --config "dab-config.MsSql.json" --permissions "policy_tester_0
update Publisher --config "dab-config.MsSql.json" --permissions "database_policy_tester:read" --policy-database "@item.id ne 1234 or @item.id gt 1940"
update Publisher --config "dab-config.MsSql.json" --permissions "database_policy_tester:update" --policy-database "@item.id ne 1234"
update Publisher --config "dab-config.MsSql.json" --permissions "database_policy_tester:create" --policy-database "@item.name ne 'New publisher'"
update Publisher --config "dab-config.MsSql.json" --permissions "role_multiple_create_policy_tester:create" --policy-database "@item.name ne 'Test'"
update Publisher --config "dab-config.MsSql.json" --permissions "role_multiple_create_policy_tester:read,update,delete"
update Publisher_MM --config "dab-config.MsSql.json" --permissions "authenticated:*" --relationship books_mm --relationship.fields "id:publisher_id" --target.entity Book_MM --cardinality many
update Stock --config "dab-config.MsSql.json" --permissions "authenticated:create,read,update,delete"
update Stock --config "dab-config.MsSql.json" --permissions "test_role_with_excluded_fields_on_create:read,update,delete"
update Stock --config "dab-config.MsSql.json" --permissions "test_role_with_excluded_fields_on_create:create" --fields.exclude "piecesAvailable"
Expand Down Expand Up @@ -112,12 +120,27 @@ update Book --config "dab-config.MsSql.json" --permissions "test_role_with_exclu
update Book --config "dab-config.MsSql.json" --permissions "test_role_with_excluded_fields:read" --fields.exclude "publisher_id"
update Book --config "dab-config.MsSql.json" --permissions "test_role_with_policy_excluded_fields:create,update,delete"
update Book --config "dab-config.MsSql.json" --permissions "test_role_with_policy_excluded_fields:read" --fields.exclude "publisher_id" --policy-database "@item.title ne 'Test'"
update Book --config "dab-config.MsSql.json" --permissions "role_multiple_create_policy_tester:read" --policy-database "@item.publisher_id ne 1234"
update Book --config "dab-config.MsSql.json" --permissions "role_multiple_create_policy_tester:create" --policy-database "@item.title ne 'Test'"
update Book --config "dab-config.MsSql.json" --permissions "role_multiple_create_policy_tester:update,delete"
update Book_MM --config "dab-config.MsSql.json" --permissions "authenticated:*"
update Book_MM --config "dab-config.MsSql.json" --relationship publishers --target.entity Publisher_MM --cardinality one --relationship.fields "publisher_id:id"
update Book_MM --config "dab-config.MsSql.json" --relationship reviews --target.entity Review_MM --cardinality many --relationship.fields "id:book_id"
update Book_MM --config "dab-config.MsSql.json" --relationship authors --relationship.fields "id:id" --target.entity Author_MM --cardinality many --linking.object book_author_link_mm --linking.source.fields "book_id" --linking.target.fields "author_id"
update Review --config "dab-config.MsSql.json" --permissions "authenticated:create,read,update,delete"
update Review --config "dab-config.MsSql.json" --relationship books --target.entity Book --cardinality one
update Review --config "dab-config.MsSql.json" --relationship website_users --target.entity WebsiteUser --cardinality one --relationship.fields "websiteuser_id:id"
update Review --config "dab-config.MsSql.json" --permissions "role_multiple_create_policy_tester:read" --policy-database "@item.websiteuser_id ne 1"
update Review --config "dab-config.MsSql.json" --permissions "role_multiple_create_policy_tester:create" --policy-database "@item.content ne 'Great'"
update Review --config "dab-config.MsSql.json" --permissions "role_multiple_create_policy_tester:update,delete"
update Review_MM --config "dab-config.MsSql.json" --permissions "authenticated:*" --relationship books --relationship.fields "book_id:id" --target.entity Book_MM --cardinality one
update Review_MM --config "dab-config.MsSql.json" --relationship website_users --target.entity WebsiteUser_MM --cardinality one --relationship.fields "websiteuser_id:id"
update BookWebsitePlacement --config "dab-config.MsSql.json" --permissions "authenticated:create,update" --rest true --graphql true
update BookWebsitePlacement --config "dab-config.MsSql.json" --permissions "authenticated:delete" --fields.include "*" --policy-database "@claims.userId eq @item.id"
update Author --config "dab-config.MsSql.json" --permissions "authenticated:create,read,update,delete" --rest true --graphql true
update WebsiteUser --config "dab-config.MsSql.json" --permissions "authenticated:create,read,delete,update" --rest false --graphql "websiteUser:websiteUsers"
update WebsiteUser -c "dab-config.MsSql.json" --relationship reviews --target.entity Review --cardinality many --relationship.fields "id:websiteuser_id"
update WebsiteUser_MM --config "dab-config.MsSql.json" --source website_users_mm --permissions "authenticated:*" --relationship reviews --relationship.fields "id:websiteuser_id" --target.entity Review_MM --cardinality many
update Revenue --config "dab-config.MsSql.json" --permissions "database_policy_tester:create" --policy-database "@item.revenue gt 1000"
update Comic --config "dab-config.MsSql.json" --permissions "authenticated:create,read,update,delete" --rest true --graphql true --relationship myseries --target.entity series --cardinality one
update series --config "dab-config.MsSql.json" --relationship comics --target.entity Comic --cardinality many
Expand All @@ -134,6 +157,7 @@ update books_view_with_mapping --config "dab-config.MsSql.json" --map "id:book_i
update BookWebsitePlacement --config "dab-config.MsSql.json" --relationship books --target.entity Book --cardinality one
update SupportedType --config "dab-config.MsSql.json" --map "id:typeid" --permissions "authenticated:create,read,delete,update"
update Author --config "dab-config.MsSql.json" --relationship books --target.entity Book --cardinality many --linking.object book_author_link
update Author_MM --config "dab-config.MsSql.json" --permissions "authenticated:*" --relationship books --relationship.fields "id:id" --target.entity Book_MM --cardinality many --linking.object book_author_link_mm --linking.source.fields "author_id" --linking.target.fields "book_id"
update Notebook --config "dab-config.MsSql.json" --permissions "anonymous:create,update,delete"
update Empty --config "dab-config.MsSql.json" --permissions "anonymous:read"
update Journal --config "dab-config.MsSql.json" --permissions "policy_tester_noupdate:update" --fields.include "*" --policy-database "@item.id ne 1"
Expand Down
6 changes: 5 additions & 1 deletion src/Config/DataApiBuilderException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ public enum SubStatusCodes
/// <summary>
/// Invalid PK field(s) specified in the request.
/// </summary>
InvalidIdentifierField
InvalidIdentifierField,
/// <summary>
/// Relationship Field's value not found
/// </summary>
RelationshipFieldNotFound
}

public HttpStatusCode StatusCode { get; }
Expand Down
10 changes: 9 additions & 1 deletion src/Core/Resolvers/BaseSqlQueryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,16 @@ protected virtual string Build(Predicate? predicate)
/// <summary>
/// Build and join predicates with separator (" AND " by default)
/// </summary>
protected string Build(List<Predicate> predicates, string separator = " AND ")
/// <param name="predicates">List of predicates to be added</param>
/// <param name="separator">Operator to be used with the list of predicates. Default value: AND</param>
/// <param name="isMultipleCreateOperation">Indicates whether the predicates are being formed for a multiple create operation. Default value: false.</param>
protected string Build(List<Predicate> predicates, string separator = " AND ", bool isMultipleCreateOperation = false)
{
if (isMultipleCreateOperation)
{
return "(" + string.Join(separator, predicates.Select(p => Build(p))) + ")";
}

return string.Join(separator, predicates.Select(p => Build(p)));
}

Expand Down
1 change: 1 addition & 0 deletions src/Core/Resolvers/IQueryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public interface IQueryBuilder
/// query.
/// </summary>
public string Build(SqlQueryStructure structure);

/// <summary>
/// Builds the query specific to the target database for the given
/// SqlInsertStructure object which holds the major components of the
Expand Down
14 changes: 14 additions & 0 deletions src/Core/Resolvers/IQueryEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ public interface IQueryEngine
/// </returns>
public Task<Tuple<JsonDocument?, IMetadata?>> ExecuteAsync(IMiddlewareContext context, IDictionary<string, object?> parameters, string dataSourceName);

/// <summary>
/// Executes the given IMiddlewareContext of the GraphQL query and expects a list of JsonDocument objects back.
/// This method accepts a list of PKs for which to construct and return the response.
/// </summary>
/// <param name="context">IMiddleware context of the GraphQL query</param>
/// <param name="parameters">List of PKs for which the response Json have to be computed and returned.
/// Each Pk is represented by a dictionary where (key, value) as (column name, column value).
/// Primary keys can be of composite and be of any type. Hence, the decision to represent
/// a PK as Dictionary<string, object?>
/// </param>
/// <param name="dataSourceName">DataSource name</param>
/// <returns>Returns the json result and metadata object for the given list of PKs</returns>
public Task<Tuple<JsonDocument?, IMetadata?>> ExecuteMultipleCreateFollowUpQueryAsync(IMiddlewareContext context, List<IDictionary<string, object?>> parameters, string dataSourceName) => throw new NotImplementedException();

/// <summary>
/// Executes the given IMiddlewareContext of the GraphQL and expecting a
/// list of Jsons back.
Expand Down
55 changes: 53 additions & 2 deletions src/Core/Resolvers/IQueryExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,28 @@ public interface IQueryExecutor
HttpContext? httpContext = null,
List<string>? args = null);

/// <summary>
/// Executes sql text with the given parameters and
/// uses the function dataReaderHandler to process
/// the results from the DbDataReader and return into an object of type TResult.
/// This method is synchronous. It does not make use of async/await.
/// </summary>
/// <param name="sqltext">SQL text to be executed.</param>
/// <param name="parameters">The parameters used to execute the SQL text.</param>
/// <param name="dataReaderHandler">The function to invoke to handle the results
/// in the DbDataReader obtained after executing the query.</param>
/// <param name="httpContext">Current request httpContext.</param>
/// <param name="args">List of string arguments to the DbDataReader handler.</param>
/// <param name="dataSourceName">dataSourceName against which to run query. Can specify null or empty to run against default db.</param>
/// <returns>An object formed using the results of the query as returned by the given handler.</returns>
public TResult? ExecuteQuery<TResult>(
string sqltext,
IDictionary<string, DbConnectionParam> parameters,
Func<DbDataReader, List<string>?, TResult>? dataReaderHandler,
HttpContext? httpContext = null,
List<string>? args = null,
string dataSourceName = "");

/// <summary>
/// Extracts the rows from the given DbDataReader to populate
/// the JsonArray to be returned.
Expand Down Expand Up @@ -63,10 +85,20 @@ public Task<JsonArray> GetJsonArrayAsync(
/// <param name="dbDataReader">A DbDataReader</param>
/// <param name="args">List of columns to extract. Extracts all if unspecified.</param>
/// <returns>Current Result Set in the DbDataReader.</returns>
public Task<DbResultSet> ExtractResultSetFromDbDataReader(
public Task<DbResultSet> ExtractResultSetFromDbDataReaderAsync(
DbDataReader dbDataReader,
List<string>? args = null);

/// <summary>
/// Extracts the current Result Set of DbDataReader and format it
/// so it can be used as a parameter to query execution.
/// This method is synchronous. This does not make use of async await operations.
/// </summary>
/// <param name="dbDataReader">A DbDataReader</param>
/// <param name="args">List of columns to extract. Extracts all if unspecified.</param>
/// <returns>Current Result Set in the DbDataReader.</returns>
public DbResultSet ExtractResultSetFromDbDataReader(DbDataReader dbDataReader, List<string>? args = null);

/// <summary>
/// Extracts the result set corresponding to the operation (update/insert) being executed.
/// For PgSql,MySql, returns the first result set (among the two for update/insert) having non-zero affected rows.
Expand All @@ -87,7 +119,18 @@ public Task<DbResultSet> GetMultipleResultSetsIfAnyAsync(
/// <param name="dbDataReader">A DbDataReader.</param>
/// <param name="args">List of string arguments if any.</param>
/// <returns>A dictionary of properties of the DbDataReader like RecordsAffected, HasRows.</returns>
public Task<Dictionary<string, object>> GetResultProperties(
public Task<Dictionary<string, object>> GetResultPropertiesAsync(
DbDataReader dbDataReader,
List<string>? args = null);

/// <summary>
/// Gets the result properties like RecordsAffected, HasRows in a dictionary.
/// This is a synchronous method. It does not make use of async/await.
/// </summary>
/// <param name="dbDataReader">A DbDataReader.</param>
/// <param name="args">List of string arguments if any.</param>
/// <returns>A dictionary of properties of the DbDataReader like RecordsAffected, HasRows.</returns>
public Dictionary<string, object> GetResultProperties(
DbDataReader dbDataReader,
List<string>? args = null);

Expand All @@ -98,6 +141,14 @@ public Task<Dictionary<string, object>> GetResultProperties(
/// </summary>
public Task<bool> ReadAsync(DbDataReader reader);

/// <summary>
/// Wrapper for DbDataReader.Read().
/// This will catch certain db errors and throw an exception which can
/// be reported to the user.
/// This method is synchronous. It does not make use of async/await.
/// </summary>
public bool Read(DbDataReader reader);

/// <summary>
/// Modified the properties of the supplied connection to support managed identity access.
/// </summary>
Expand Down
15 changes: 14 additions & 1 deletion src/Core/Resolvers/MsSqlQueryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,24 @@ public string Build(SqlQueryStructure structure)
structure.JoinQueries.Select(
x => $" OUTER APPLY ({Build(x.Value)}) AS {QuoteIdentifier(x.Key)}({dataIdent})"));

string predicates = JoinPredicateStrings(
string predicates;

if (structure.IsMultipleCreateOperation)
{
predicates = JoinPredicateStrings(
structure.GetDbPolicyForOperation(EntityActionOperation.Read),
structure.FilterPredicates,
Build(structure.Predicates, " OR ", isMultipleCreateOperation: true),
Build(structure.PaginationMetadata.PaginationPredicate));
}
else
{
predicates = JoinPredicateStrings(
structure.GetDbPolicyForOperation(EntityActionOperation.Read),
structure.FilterPredicates,
Build(structure.Predicates),
Build(structure.PaginationMetadata.PaginationPredicate));
}

string query = $"SELECT TOP {structure.Limit()} {WrappedColumns(structure)}"
+ $" FROM {fromSql}"
Expand Down
4 changes: 2 additions & 2 deletions src/Core/Resolvers/MsSqlQueryExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public override async Task<DbResultSet> GetMultipleResultSetsIfAnyAsync(
DbDataReader dbDataReader, List<string>? args = null)
{
// From the first result set, we get the count(0/1) of records with given PK.
DbResultSet resultSetWithCountOfRowsWithGivenPk = await ExtractResultSetFromDbDataReader(dbDataReader);
DbResultSet resultSetWithCountOfRowsWithGivenPk = await ExtractResultSetFromDbDataReaderAsync(dbDataReader);
DbResultSetRow? resultSetRowWithCountOfRowsWithGivenPk = resultSetWithCountOfRowsWithGivenPk.Rows.FirstOrDefault();
int numOfRecordsWithGivenPK;

Expand All @@ -249,7 +249,7 @@ public override async Task<DbResultSet> GetMultipleResultSetsIfAnyAsync(
}

// The second result set holds the records returned as a result of the executed update/insert operation.
DbResultSet? dbResultSet = await dbDataReader.NextResultAsync() ? await ExtractResultSetFromDbDataReader(dbDataReader) : null;
DbResultSet? dbResultSet = await dbDataReader.NextResultAsync() ? await ExtractResultSetFromDbDataReaderAsync(dbDataReader) : null;

if (dbResultSet is null)
{
Expand Down
Loading