Skip to content

Custom Sql Patterns #73

@jackcb123

Description

@jackcb123

Hi! We use a lot of sql patterns where we have comments at the beginning of custom queries in blocks or in-line, use ctes like 'WITH' , etc. Is it possible to customize the sql checker that decides whether to use the primary or replica? If not, do you mind me asking where that occurs within your repo?

This is what we currently use with makara if that's helpful! Hoping to make the switch to yours (as of course makara is no longer maintained)

CUSTOM_SQL_REPLICA_MATCHERS = [
# Match comment blocks + inline comments and whitespace, finding queries with the 'with' or 'select' keywords
/\A\s*((--.\n\s)|(/*.?*/\s))*\b(select|with)\b/i
].freeze

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions