Unrestricted Updates/Inserts/Deletes

Open
#417 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
fsharp, sql
Domain
database

Research direction

Review the existing CRUD operations and LINQ query support in the SQLProvider type provider, focusing on the update, insert, and delete examples described in the issue. Determine whether query-side joins, filters, and values from F# can express these set-based SQL operations. Done means documenting current support or defining an agreed implementation scope for the requested operations.

Written by the indexing model from the issue text.

Description

enhancement

I noticed recently some issues/pr's in a similar vein, namely one relating to unrestricted deletes, and another about comparing two columns both on the query side (rather than the left being an F# value).

I'd like to be able to do something equivalent to the following:

UPDATE A
    SET A.COLUMN1 = 'FSHARP VALUE'
WHERE A.COLUMN2 = 'ANOTHER FSHARP VALUE'

or, more involving:

UPDATE A
    SET A.COLUMN1 = B.COLUMN2
FROM TABLEA AS A
INNER JOIN TABLEB AS B
    ON A.KEY = B.KEY
WHERE A.COLUMN3 = 'FSHARP VALUE'

edit for some other examples:

INSERT INTO TABLEA
SELECT COLUMN1,COLUMN2,'FSHARP VALUE1'
FROM TABLEB
WHERE TABLEB.COLUMN1 = 'FSHARP VALUE2'
DELETE TABLEA
FROM TABLEA
INNER JOIN TABLEB
    ON TABLEA.KEY =TABLEB.KEY
WHERE TABLEB.COLUMN1 = 'FSHARP VALUE1'

Basically, I want to push as much of the operational semantics to the SQL layer as possible, influencing the query only with some values from F#, mostly to constrain joins/where/group/having clauses. The goal is to stop having to produce UDF/PROC's in native T-SQL in order to perform set based updates/inserts.

Is something like this already possible? Is it antithetical to the intent of this type provider?

Dominant language
F#
Stars
627
Forks
147
Avg merge
2h 2m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fsprojects/SQLProvider

All issues in fsprojects/SQLProvider

Similar issues

More Databases issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.