analytics/priv/data_migrations/NumericIDs/sql/insert-into-tmp-events-v2.sql.eex
Adam 6637751a5e
Implement Numeric IDs migration (#2762)
* Implement Numeric IDs migration

* Fix typo

* Mute credo for now

* Improve configurability and add stop_t

* Adjust to Ch/Chto only

* Fix opts key for dictionary password

* Add regular ecto migration with numeric ids v2 schemas (#2768)

* Add regular ecto migration

* Fix typo

* Update priv/ingest_repo/migrations/20230320094327_create_v2_schemas.exs

Co-authored-by: Vini Brasil <vini@hey.com>

* Implement v2 events/sessions schema modules (#2777)

* Implement v2 events/sessions schema modules

* Clean up session schemas

---------

Co-authored-by: Vini Brasil <vini@hey.com>

* Update moduledocs

---------

Co-authored-by: Vini Brasil <vini@hey.com>
2023-03-23 09:47:41 +01:00

55 lines
1.0 KiB
Elixir

INSERT INTO tmp_events_v2 (
site_id, timestamp, name, user_id,
session_id, hostname, pathname, referrer,
referrer_source, country_code, screen_size,
operating_system, browser, utm_medium,
utm_source, utm_campaign, meta.key,
meta.value, browser_version, operating_system_version,
subdivision1_code, subdivision2_code,
city_geoname_id, utm_content, utm_term,
transferred_from
)
SELECT
dictGet(
'domains_lookup', 'site_id', domain
),
timestamp,
name,
user_id,
session_id,
hostname,
pathname,
referrer,
referrer_source,
country_code,
screen_size,
operating_system,
browser,
utm_medium,
utm_source,
utm_campaign,
meta.key,
meta.value,
browser_version,
operating_system_version,
subdivision1_code,
subdivision2_code,
city_geoname_id,
utm_content,
utm_term,
transferred_from
FROM
events
WHERE
(
domain IN (
SELECT
domain
FROM
dictionary('domains_lookup')
WHERE
partition <= '<%= @partition %>'
)
)
AND (_partition_id = '<%= @partition %>')