Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
from random import randint
import tornado.concurrent
import tornado.platform.asyncio
import tornado.web
from aiopg.sa import create_engine as aiopg_create_engine
import asyncio
SELECT
company_name,
(last_name || ' ' || SUBSTRING(first_name, 1, 1) || '.' || SUBSTRING(middle_name, 1, 1) || '.') employee_name,
to_char(inner_date_create, 'YYYY-DD-MM HH24:MI') date_create,
sum(inner_assigned) assigned,
sum(inner_complete) complete,
sum(inner_fail) fail
FROM (
SELECT
company."NAME" company_name,
# coding: utf-8
from datetime import datetime
import tornado.gen
from handlers.ets_mission import MissionHandler
from handlers.ets_waybill import WaybillHandler
from utils.check_date_overlap import (
check_date_overlap, CHECK_DATE_OVERLAP_ERROR_MESSAGE)
CREATE MATERIALIZED VIEW mv_controller_dir_oracle AS
SELECT
con.gis_id AS PP_ID,
cmr3.NAME_DIRECTION,
cmr3.day_timestamp,
cmr3.plan_time_on,
cmr3.plan_time_off,
CASE WHEN length(string_agg(cmr3.periods, ', ' :: TEXT ORDER BY cmr3.start_timestamp)) > 3999
THEN left(string_agg(cmr3.periods, ', ' :: TEXT ORDER BY cmr3.start_timestamp), 3995) || '...'
ELSE string_agg(cmr3.periods, ', ' :: TEXT ORDER BY cmr3.start_timestamp) END AS periods,