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.

Use Dialects Enum instead of literals

See original GitHub issue

We hardcode a dialect literal everywhere for example: “clickhouse” in:

  • sqlglot.transpile(query, read=“clickhouse”)
  • sqlglot.parse_one(query, read=“clickhouse”)
  • parsed_query.sql(dialect=“clickhouse”)

I think the best approach to use a Enum for all sqlglot dialects For example: from sqlglot import DialectType

  • sqlglot.transpile(query, read=DialectType.CLICKHOUSE)
  • sqlglot.parse_one(query, read=DialectType.CLICKHOUSE)
  • parsed_query.sql(dialect=DialectType.CLICKHOUSE)

@tobymao What do you think about it? Is it the good idea?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:17 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
tobymaocommented, Aug 12, 2022

not yet, maybe next month, for now you can hit me up on discord directly captaintobs#2594

0reactions
barakaloncommented, Aug 12, 2022

Oops, sorry. I see I’m late to the party. Don’t mind me…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Literal types and Enums - mypy 0.991 documentation
Literal types may contain one or more literal bools, ints, strs, bytes, and enum values. However, literal types cannot contain arbitrary expressions: types...
Read more >
13 Alternatives to enums in TypeScript
An enum maps member names to member values. If we don't need or want the indirection, we can use a union of so-called...
Read more >
Why use Enums instead of Constants? Which is better in ...
Enums limit you to the required set of inputs whereas even if you use constant strings you still can use other String ...
Read more >
Choosing Between TypeScript String Literals and Enums
In this web development tutorial we look at the differences between TypeScript String Literal Unions and enums. Learn more.
Read more >
TypeScript string enums, and when and how to use them
Specifying enum member values​​ Values are initialized implicitly via number literals, or explicitly via string literals. Constant enum members: ...
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