GithubHelp home page GithubHelp logo

Linq Query Support about fsharp.cosmosdb HOT 5 OPEN

aaronpowell avatar aaronpowell commented on June 15, 2024
Linq Query Support

from fsharp.cosmosdb.

Comments (5)

albert-du avatar albert-du commented on June 15, 2024 1

Currently I'm looking to support built in F# functions by replacing them with the BCL equivalents

Math operations are supported normally but not the F# versions

Math functions: Supports translation from .NET Abs, Acos, Asin, Atan, Ceiling, Cos, Exp, Floor, Log, Log10, Pow, Round, Sign, Sin, Sqrt, Tan, and Truncate to the equivalent built-in mathematical functions.
https://docs.microsoft.com/en-us/azure/cosmos-db/sql/sql-query-linq-to-sql

For example, trying to use the "abs" function in a query ce with Cosmos fails, but the equivalent "System.Math.Abs" method works.

This query builder is just to show extending the operations available by mapping F# functions to BCL methods.

from fsharp.cosmosdb.

bartelink avatar bartelink commented on June 15, 2024

I know it's only an example, but can you clarify what sort of stuff you're intending to handle in your query support ?

I've not read or stretched it but I believe Microsoft.Azure.Cosmos has prerry complete LINQ support - are you intending to do some fixups in front of that, or replace the the whole engine?

If you're leaning towards the replacing the whole thing, it may also be worthwhile to peruse https://github.com/fsprojects/FSharp.AWS.DynamoDB (obviously it has a different query syntax, but there are lots of aspects of it which have been implemented very cleanly)

from fsharp.cosmosdb.

aaronpowell avatar aaronpowell commented on June 15, 2024

I'll admit that I'm somewhat torn here - I like the idea of having a strongly-typed query engine, such as you get with LINQ, so that you can have more confidence in the queries that you write, but at the same time I ponder it relative to the analyzer part of this project (and which was one of the key motivations in building it). I want to explore a bit more how they play together, can we get better analysis of the query-to-generate by using LINQ, to maybe suggest where your projections are not valid for the database you're working with? I'm not sure, but it's something to explore.

from fsharp.cosmosdb.

albert-du avatar albert-du commented on June 15, 2024

I believe Linq could be leveraged to provide greater insight with the analyzer. For instance, the Cosmos Linq provider allows for translation of strongly typed queries directly into sql which could be a basis for providing autocomplete suggestions or additional code linting.

from fsharp.cosmosdb.

aaronpowell avatar aaronpowell commented on June 15, 2024

Yes, it does allow for strongly typed query creation because you're working off the in/out types, but I have to look at the analyzer and see if the type information is available - Last time I looked you were really only working with strings (as you're working on the tokens in the AST), but that might be outdated.

from fsharp.cosmosdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.