Skip to content

Instantly share code, notes, and snippets.

with t as (select date,
clientid,
arrayJoin(JSONExtract(assumeNotNull(hour_info),'Array(String)')) as hour,
arrayJoin(extractAll(assumeNotNull(productSku),'"(\\w+)"')) as product
from {{ ref("src_for_web_sessions") }})
select CAST(t.date as Date) as "Дата", t.hour as "Час", item.`ссылка` as "Товар", count(*) as "Количество просмотров" from t
join (select * from {{source('bq','`cifra_товары`')}} ) as item on item.`код sku` = t.product
group by t.date, t.hour, item.`ссылка`, t.clientid
UNION ALL
select CAST(t.date as Date) as "Дата", t.hour as "Час", item.`ссылка` as "Товар", count(*) as "Количество просмотров" from t
Select
user_id, user_phone, user_email,
clientid, date,/* sessionid , visitnumber,newvisits,
device_category, device_browser, device_browser_version,
device_operating_system, device_operating_system_version,
device_mobile_device_info, device_ip, device_user_agent, device_language
geonetwork_country, geonetwork_country_iso_code, geonetwork_region,
geonetwork_region_iso_code, geonetwork_city,geonetwork_latitude, geonetwork_longitude,
trafficsource_channelgrouping, trafficsource_source, trafficsource_medium,
trafficsource_campaign, trafficsource_keyword, trafficsource_adcontent, trafficsource_adgroup,
insert into clickhouse.dbt_bq.dm_owoxbi_sessions
Select
user.id as user_id, user.phone as user_phone, user.email as user_email,
clientId as clientId, date as date, sessionId as sessionId , visitNumber as visitNumber,newVisits as newVisits,
t.device.deviceCategory as device_category, t.device.browser as device_browser, t.device.browserVersion as device_browser_version,
t.device.operatingSystem as device_operating_system, t.device.operatingSystemVersion as device_operating_system_version,
t.device.mobileDeviceInfo as device_mobile_device_info, t.device.ip as device_ip, t.device.userAgent as device_user_agent, t.device.language as device_language,
geoNetwork.country as geoNetwork_country, geoNetwork.countryIsoCode as geoNetwork_country_iso_code, geoNetwork.region as geoNetwork_region,
geoNetwork.regionIsoCode as geoNetwork_region_iso_code, geoNetwork.city as geoNetwork_city,geoNetwork.latitude as geoNetwork_latitude, geoNetwork.longitude as geoNetwork_longitude,
trafficSource.channelGrouping as
from sched import scheduler
from dagster import job, op, Failure, sensor, RunRequest,schedule,SkipReason
from .dbt_cube import dbt_cube_and_exposure_incremental
from dagster.core.storage.pipeline_run import (
RunsFilter,
PipelineRunStatus,
)
import time
import datetime
from dagster import job, op, Failure, sensor, RunRequest
from test_job import test_job
from dagster_celery import celery_executor
from dagster.core.storage.pipeline_run import (
RunsFilter,
PipelineRunStatus,
)
@op
from dagster import job, op, Failure, sensor, RunRequest
from dagster_celery import celery_executor
from dagster.core.storage.pipeline_run import (
RunsFilter,
PipelineRunStatus,
)
import time
#def sensor_A():
# yield RunRequest(run_key=None, run_config={})
@sensor(job=test_job,minimum_interval_seconds=10)
from distutils.debug import DEBUG
from pickle import TRUE
import json
import os
import collections
from collections import defaultdict
DEBUG = TRUE
from distutils.debug import DEBUG
from pickle import TRUE
import json
import os
import collections
from collections import defaultdict
DEBUG = TRUE
defaultdict( < class 'set' > , {
'metadata': {
('dbt_schema_version', 'dbt_version', 'generated_at', 'invocation_id', 'env', 'project_id', 'user_id', 'send_anonymous_usage_stats', 'adapter_type')
},
'nodes': {
('model.trino_project.dm_документреализации', 'model.trino_project.dm_покупатели', 'model.trino_project.dm_размеры', 'model.trino_project.dm_магазины', 'model.trino_project.dm_товары'),
('model.click_project.src_clientscluster', ),
('model.cifra_project.dm_ДефектныйТовар', 'model.cifra_project.dm_Комиссия', 'model.cifra_project.dm_ЦеныЗакупки', 'model.cifra_project.dm_ЦеныНоменклатуры', 'model.cifra_project.dm_ДвижениеТоваров', 'model.cifra_project.dm_Clickhouse_indicator', 'model.cifra_project.dm_РегистрСведений_СтатусыКартPrivilege', 'model.cifra_project.v_Clickhouse_indicator_variance', 'model.cifra_project.dm_КурсыВалют', 'model.cifra_project.dm_Магазины', 'model.cifra_project.dm_ПоказателиПоМагазинам', 'model.cifra_project.dm_РСТ', 'model.cifra_project.dm_Сотрудники', 'model.cifra_projec
from distutils.debug import DEBUG
from pickle import TRUE
import json
import os
import collections
from collections import defaultdict
DEBUG = TRUE
dict_1 = {'John': 15, 'Rick': {10,15}, 'Misa': 12}