<commit_before>
module Okdoki
  class SQL_Code

    CTE_COLS = {
      Story    => [:mag_id, Magazine].freeze,
      Magazine => [:publisher_id, Screen_Name].freeze,
      Screen_Name => [:owner_id, Customer].freeze,
      Customer => [nil, nil].freeze
    }

    SQL_Templates = [
      # === TOP
      %~
        SELECT ? AS class_id, id, NULL AS parent_id
        FROM :klass
        WHERE id IN ( SELECT parent_id FROM :child_klass_parent )
      ~.rstrip,

      # === MIDDLE
      %~
        SELECT ? AS class_id, id, ? AS parent_id
        FROM :klass
        WHERE id = ( SELECT parent_id FROM :child_klass_parent )
      ~.rstrip,

      # === BOTTOM
      %~
        SELECT ? AS class_id, id, ? AS parent_id
        FROM :klass
        WHERE id = :klass_table
      ~.rstrip
    ]

    def initialize klass, id
      @with   = []
      @sql    = []<commit_msg>Touchup.<commit_after>
module Okdoki
  class SQL_Code

    CTE_COLS = {
      Story       => [:mag_id, Magazine].freeze,
      Magazine    => [:publisher_id, Screen_Name].freeze,
      Screen_Name => [:owner_id, Customer].freeze,
      Customer    => [nil, nil].freeze
    }

    SQL_Templates = [
      # === TOP
      %~
        SELECT ? AS class_id, id, NULL AS parent_id
        FROM :klass
        WHERE id IN ( SELECT parent_id FROM :child_klass_parent )
      ~.rstrip,

      # === MIDDLE
      %~
        SELECT ? AS class_id, id, ? AS parent_id
        FROM :klass
        WHERE id = ( SELECT parent_id FROM :child_klass_parent )
      ~.rstrip,

      # === BOTTOM
      %~
        SELECT ? AS class_id, id, ? AS parent_id
        FROM :klass
        WHERE id = :klass_table
      ~.rstrip
    ]

    def initialize klass, id
      @with   = []
      @sql    = []
{'fraction_non_alphanumeric': 0.11181192660550458, 'fraction_numerical': 0.0, 'mean_word_length': 1.7742448330683624, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7555967', 'n_tokens_mistral': 596, 'n_tokens_neox': 581, 'n_words': 144}