question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for snake_case column names

See original GitHub issue

Hi,

the preferred naming convention for postgres databases calls for table/column names to be using snake_case, since Dapper allows reading such columns with Dapper.DefaultTypeMap.MatchNamesWithUnderscores <- true could we also somehow add an option for names in record fields to be interpreted as snake_case?

Example:

let r = {
    Id = Guid.NewGuid()
    FirstName = "Works"
    LastName = "Great"
    DateOfBirth = DateTime.Today
    Position = 1
}

let sql, values =
    insert {
        table "person"
        value r
    } |> Deconstructor.insert

printfn "%s" sql 
// INSERT INTO person (id, first_name, last_name, position, date_of_birth) 
// VALUES (@Id0, @FirstName0, @LastName0, @Position0, @DateOfBirth0)"

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Dzoukrcommented, Mar 10, 2021

Thanks for the offer, Michal, but I decided not to complicate the library. Custom mapping over column names is a rabbit hole in the long-term and I’ll keep trying to avoid it as long as possible.

0reactions
mnebescommented, Mar 9, 2021

I also thought it could be a nice indicator that such a record should never leave the context of data access. Anyways, if you decide against such a feature just close this issue, as I said, I can easily work around this. Of course if you decide for it I’d be happy to help with the implementation!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Convert dataframe column names from camel case to ...
Convert dataframe column names from camel case to snake case ... I want to change the column labels of a Pandas DataFrame from...
Read more >
Using snake case column names with Dapper and ...
In this post I describe how to use snake case naming conventions when using Dapper, by using "Schema" utility classes, nameof(), ...
Read more >
Format names and values — format_names • cleaner
This function can be used on any data.frame , list or character vector to format their names or values. It supports snake case...
Read more >
Snake case
It is a commonly used naming convention in computing, for example for variable and subroutine names, and for filenames. One study has found...
Read more >
Change jdbc column names to snake case as default. #2074
The request of this issue is to change the default table and column definitions from camelCase/PascalCase to snake case to make it more...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found