Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eas optimism: exclude troubled rows #5908

Merged
merged 1 commit into from
May 9, 2024
Merged

eas optimism: exclude troubled rows #5908

merged 1 commit into from
May 9, 2024

Conversation

jeff-dude
Copy link
Member

fyi @tomfutago
hitting dupes on this one in prod. since they made it into the target already, rather than exclude the whole model, i'm excluding the troubled rows to refresh the spells.

select
  schema_uid,
  count(1)
from
  eas_optimism.schemas
group by
  schema_uid
having
  count(1) > 1
with
  src as (
    with
      src_SchemaRegistry_evt_Registered as (
        select
          *
        from
          "delta_prod"."attestationstation_v1_optimism"."SchemaRegistry_evt_Registered"
      ),
      src_SchemaRegistry_call_register as (
        select
          *
        from
          "delta_prod"."attestationstation_v1_optimism"."SchemaRegistry_call_register"
      )
    select
      'optimism' as blockchain,
      'eas' as project,
      '1' as version,
      er.uid as schema_uid,
      er.registerer,
      cr.resolver,
      cr.schema,
      transform(split(cr.schema, ','), x -> split(trim(x), ' ')) as schema_array, -- array of 2-element arrays [[data_type,field_name],[...]]
      cr.revocable as is_revocable,
      er.contract_address,
      er.evt_block_number as block_number,
      er.evt_block_time as block_time,
      er.evt_tx_hash as tx_hash,
      er.evt_index
    from
      src_SchemaRegistry_evt_Registered er
      join src_SchemaRegistry_call_register cr on er.evt_tx_hash = cr.call_tx_hash
    where
      cr.call_success
  )
select
  schema_uid,
  count(1)
from
  src
group by
  schema_uid
having
  count(1) > 1

@jeff-dude jeff-dude merged commit 7106c3d into main May 9, 2024
3 checks passed
@jeff-dude jeff-dude deleted the fix-eas branch May 9, 2024 13:51
@github-actions github-actions bot locked and limited conversation to collaborators May 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant