https://dagster.io/ logo
#ask-community
Title
# ask-community
d

Donny Winston

08/24/2022, 6:33 PM
Is there a best practice for encoding things that are not
[A-Za-z0-9_]+
as dagster names? I find myself doing shenanigans like:
Copy code
def query_literal_to_dagster_name(s):
    return (
        s.replace(":", "___colon___")
        .replace('"', "___quote___")
        .replace(" ", "___space___")
        .replace("(", "___openparen___")
        .replace(")", "___closeparen___")
        .replace(".", "___period___")
        .replace(",", "___comma___")
    )


def dagster_name_to_query_literal(s):
    return (
        s.replace("___colon___", ":")
        .replace("___quote___", '"')
        .replace("___space___", " ")
        .replace("___openparen___", "(")
        .replace("___closeparen___", ")")
        .replace("___period___", ".")
        .replace(",", "___comma___")
    )
j

Jon Simpson

08/24/2022, 7:45 PM
Also hitting this and would be curious. Mostly with ‘-’ vs ‘_’
c

chris

08/24/2022, 9:41 PM
I don't think we have a guide or best practices around this tbh. Worth an issue / discussion: https://github.com/dagster-io/dagster/issues/9480
👍 1