Giter Site home page Giter Site logo

Comments (6)

tconbeer avatar tconbeer commented on August 30, 2024 1

Awesome, thank you for the extra info. That should make this pretty straightforward. We don't have to touch parsing and can still lowercase lots of tokens- we'll just leave identifiers (incl. function names) alone.

CLI flag should be --dialect clickhouse

from sqlfmt.

tconbeer avatar tconbeer commented on August 30, 2024 1

@Shlomixg I'm cutting the release for 0.10.0 right now -- if you upgrade, you can run that version with sqlfmt . --dialect clickhouse and we won't lowercase so many things. Would love to get any more feedback from you!

from sqlfmt.

tconbeer avatar tconbeer commented on August 30, 2024

Thanks for the report, @Shlomixg !

I had no idea ClickHouse was case sensitive. (Why would they do that to us?!)

Should be easy enough to not lowercase the output, but...

Are SQL keywords (like select) also case sensitive, or is it just some/all function names?

I designed this with multiple dialects in mind, so it shouldn't be too bad to change the parsing logic to be case-sensitive. I'm just a little sad because we've gotten away with only one "polyglot" dialect so far.

from sqlfmt.

Shlomixg avatar Shlomixg commented on August 30, 2024

Thanks for your quick response!

I think only the CH unique functions are case-sensitive, meaning that select isn't case-sensitive.
You can find more information in the docs.
Note that aliases are also case-sensitive.

from sqlfmt.

tconbeer avatar tconbeer commented on August 30, 2024

Implementation notes (this is bigger than I thought, to get the Dialect or Mode into the Node.capitalize() method):

  • Add Dialect as a property of Analyzer
  • Create a NodeManager (NodeBuilder?) class with Dialect as a property
  • instantiate a NodeManager where needed in actions.py
  • move Node.from_token() to NodeManager.create_node_from_token(); also move Node.capitalize() and Node.whitespace()
  • update NodeManager.capitalize() to check for the Clickhouse dialect
  • update Line.append_newline() so it doesn't use Node.from_token()

from sqlfmt.

Shlomixg avatar Shlomixg commented on August 30, 2024

Bravo :)
I'll test it soon and leave feedback.
Thanks!

from sqlfmt.

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.