From ad4f8fc3d52e2b944874070d4d1908b9150a4ac4 Mon Sep 17 00:00:00 2001 From: Michael Skarbek Date: Tue, 3 Dec 2024 15:59:09 -0500 Subject: [PATCH] drop unused dash app and upgrade sqlalchemy (#236) --- Dockerfile | 1 - Pipfile | 3 +- Pipfile.lock | 411 +++--------------- app.py | 62 --- kokudaily/charts/__init__.py | 3 - kokudaily/charts/engineering.py | 23 - kokudaily/charts/index.py | 6 - kokudaily/charts/marketing.py | 23 - kokudaily/charts/utils.py | 15 - kokudaily/reports.py | 5 +- .../sql/cust_cost_model_report_setup.sql | 6 +- kokudaily/sql/cust_node_report_setup.sql | 4 +- kokudaily/sql/cust_size_report_setup.sql | 24 +- kokudaily/sql/cust_tag_report_setup.sql | 10 +- .../cust_cloud_costs_data_setup.sql | 46 +- .../cust_openshift_costs_data_setup.sql | 44 +- .../cust_openshift_infra_data_setup.sql | 36 +- 17 files changed, 159 insertions(+), 563 deletions(-) delete mode 100755 app.py delete mode 100644 kokudaily/charts/__init__.py delete mode 100644 kokudaily/charts/engineering.py delete mode 100644 kokudaily/charts/index.py delete mode 100644 kokudaily/charts/marketing.py delete mode 100644 kokudaily/charts/utils.py diff --git a/Dockerfile b/Dockerfile index ab3c0e5..ec6ffc4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -70,7 +70,6 @@ ENV \ # copy the src files into the workdir COPY kokudaily kokudaily -COPY app.py . COPY job.py . COPY LICENSE /licenses/MIT.txt diff --git a/Pipfile b/Pipfile index 7de47be..af04027 100644 --- a/Pipfile +++ b/Pipfile @@ -6,8 +6,7 @@ name = "pypi" [packages] pre-commit = "*" psycopg2-binary = ">=2.7.0" -sqlalchemy = "==1.3.3" -dash = "*" +sqlalchemy = "*" prometheus-client = "*" python-dateutil = ">=2.8" pytz = "*" diff --git a/Pipfile.lock b/Pipfile.lock index 807c908..79d91e5 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "5556e3bc7418020e03d1fb0f27b8017904a1b7ac1ecf1f19752f278c3adaa4cf" + "sha256": "96623bc321d23929be8cfbd78ff191eddf3605cee0bee6cfd1f565fd86dc9d2c" }, "pipfile-spec": 6, "requires": { @@ -59,14 +59,6 @@ "markers": "python_version >= '3.6'", "version": "==21.2.0" }, - "blinker": { - "hashes": [ - "sha256:b4ce2265a7abece45e7cc896e98dbebe6cead56bcf805a3d23136d145f5445bf", - "sha256:ba0efaa9080b619ff2f3459d1d500c57bddea4a6b424b60a91141db6fd2f08bc" - ], - "markers": "python_version >= '3.9'", - "version": "==1.9.0" - }, "certifi": { "hashes": [ "sha256:922820b53db7a7257ffbda3f597266d435245903d80737e34f8a45ff3e3230d8", @@ -156,154 +148,6 @@ "markers": "python_version >= '3.8'", "version": "==3.4.0" }, - "charset-normalizer": { - "hashes": [ - "sha256:0099d79bdfcf5c1f0c2c72f91516702ebf8b0b8ddd8905f97a8aecf49712c621", - "sha256:0713f3adb9d03d49d365b70b84775d0a0d18e4ab08d12bc46baa6132ba78aaf6", - "sha256:07afec21bbbbf8a5cc3651aa96b980afe2526e7f048fdfb7f1014d84acc8b6d8", - "sha256:0b309d1747110feb25d7ed6b01afdec269c647d382c857ef4663bbe6ad95a912", - "sha256:0d99dd8ff461990f12d6e42c7347fd9ab2532fb70e9621ba520f9e8637161d7c", - "sha256:0de7b687289d3c1b3e8660d0741874abe7888100efe14bd0f9fd7141bcbda92b", - "sha256:1110e22af8ca26b90bd6364fe4c763329b0ebf1ee213ba32b68c73de5752323d", - "sha256:130272c698667a982a5d0e626851ceff662565379baf0ff2cc58067b81d4f11d", - "sha256:136815f06a3ae311fae551c3df1f998a1ebd01ddd424aa5603a4336997629e95", - "sha256:14215b71a762336254351b00ec720a8e85cada43b987da5a042e4ce3e82bd68e", - "sha256:1db4e7fefefd0f548d73e2e2e041f9df5c59e178b4c72fbac4cc6f535cfb1565", - "sha256:1ffd9493de4c922f2a38c2bf62b831dcec90ac673ed1ca182fe11b4d8e9f2a64", - "sha256:2006769bd1640bdf4d5641c69a3d63b71b81445473cac5ded39740a226fa88ab", - "sha256:20587d20f557fe189b7947d8e7ec5afa110ccf72a3128d61a2a387c3313f46be", - "sha256:223217c3d4f82c3ac5e29032b3f1c2eb0fb591b72161f86d93f5719079dae93e", - "sha256:27623ba66c183eca01bf9ff833875b459cad267aeeb044477fedac35e19ba907", - "sha256:285e96d9d53422efc0d7a17c60e59f37fbf3dfa942073f666db4ac71e8d726d0", - "sha256:2de62e8801ddfff069cd5c504ce3bc9672b23266597d4e4f50eda28846c322f2", - "sha256:2f6c34da58ea9c1a9515621f4d9ac379871a8f21168ba1b5e09d74250de5ad62", - "sha256:309a7de0a0ff3040acaebb35ec45d18db4b28232f21998851cfa709eeff49d62", - "sha256:35c404d74c2926d0287fbd63ed5d27eb911eb9e4a3bb2c6d294f3cfd4a9e0c23", - "sha256:3710a9751938947e6327ea9f3ea6332a09bf0ba0c09cae9cb1f250bd1f1549bc", - "sha256:3d59d125ffbd6d552765510e3f31ed75ebac2c7470c7274195b9161a32350284", - "sha256:40d3ff7fc90b98c637bda91c89d51264a3dcf210cade3a2c6f838c7268d7a4ca", - "sha256:425c5f215d0eecee9a56cdb703203dda90423247421bf0d67125add85d0c4455", - "sha256:43193c5cda5d612f247172016c4bb71251c784d7a4d9314677186a838ad34858", - "sha256:44aeb140295a2f0659e113b31cfe92c9061622cadbc9e2a2f7b8ef6b1e29ef4b", - "sha256:47334db71978b23ebcf3c0f9f5ee98b8d65992b65c9c4f2d34c2eaf5bcaf0594", - "sha256:4796efc4faf6b53a18e3d46343535caed491776a22af773f366534056c4e1fbc", - "sha256:4a51b48f42d9358460b78725283f04bddaf44a9358197b889657deba38f329db", - "sha256:4b67fdab07fdd3c10bb21edab3cbfe8cf5696f453afce75d815d9d7223fbe88b", - "sha256:4ec9dd88a5b71abfc74e9df5ebe7921c35cbb3b641181a531ca65cdb5e8e4dea", - "sha256:4f9fc98dad6c2eaa32fc3af1417d95b5e3d08aff968df0cd320066def971f9a6", - "sha256:54b6a92d009cbe2fb11054ba694bc9e284dad30a26757b1e372a1fdddaf21920", - "sha256:55f56e2ebd4e3bc50442fbc0888c9d8c94e4e06a933804e2af3e89e2f9c1c749", - "sha256:5726cf76c982532c1863fb64d8c6dd0e4c90b6ece9feb06c9f202417a31f7dd7", - "sha256:5d447056e2ca60382d460a604b6302d8db69476fd2015c81e7c35417cfabe4cd", - "sha256:5ed2e36c3e9b4f21dd9422f6893dec0abf2cca553af509b10cd630f878d3eb99", - "sha256:5ff2ed8194587faf56555927b3aa10e6fb69d931e33953943bc4f837dfee2242", - "sha256:62f60aebecfc7f4b82e3f639a7d1433a20ec32824db2199a11ad4f5e146ef5ee", - "sha256:63bc5c4ae26e4bc6be6469943b8253c0fd4e4186c43ad46e713ea61a0ba49129", - "sha256:6b40e8d38afe634559e398cc32b1472f376a4099c75fe6299ae607e404c033b2", - "sha256:6b493a043635eb376e50eedf7818f2f322eabbaa974e948bd8bdd29eb7ef2a51", - "sha256:6dba5d19c4dfab08e58d5b36304b3f92f3bd5d42c1a3fa37b5ba5cdf6dfcbcee", - "sha256:6fd30dc99682dc2c603c2b315bded2799019cea829f8bf57dc6b61efde6611c8", - "sha256:707b82d19e65c9bd28b81dde95249b07bf9f5b90ebe1ef17d9b57473f8a64b7b", - "sha256:7706f5850360ac01d80c89bcef1640683cc12ed87f42579dab6c5d3ed6888613", - "sha256:7782afc9b6b42200f7362858f9e73b1f8316afb276d316336c0ec3bd73312742", - "sha256:79983512b108e4a164b9c8d34de3992f76d48cadc9554c9e60b43f308988aabe", - "sha256:7f683ddc7eedd742e2889d2bfb96d69573fde1d92fcb811979cdb7165bb9c7d3", - "sha256:82357d85de703176b5587dbe6ade8ff67f9f69a41c0733cf2425378b49954de5", - "sha256:84450ba661fb96e9fd67629b93d2941c871ca86fc38d835d19d4225ff946a631", - "sha256:86f4e8cca779080f66ff4f191a685ced73d2f72d50216f7112185dc02b90b9b7", - "sha256:8cda06946eac330cbe6598f77bb54e690b4ca93f593dee1568ad22b04f347c15", - "sha256:8ce7fd6767a1cc5a92a639b391891bf1c268b03ec7e021c7d6d902285259685c", - "sha256:8ff4e7cdfdb1ab5698e675ca622e72d58a6fa2a8aa58195de0c0061288e6e3ea", - "sha256:9289fd5dddcf57bab41d044f1756550f9e7cf0c8e373b8cdf0ce8773dc4bd417", - "sha256:92a7e36b000bf022ef3dbb9c46bfe2d52c047d5e3f3343f43204263c5addc250", - "sha256:92db3c28b5b2a273346bebb24857fda45601aef6ae1c011c0a997106581e8a88", - "sha256:95c3c157765b031331dd4db3c775e58deaee050a3042fcad72cbc4189d7c8dca", - "sha256:980b4f289d1d90ca5efcf07958d3eb38ed9c0b7676bf2831a54d4f66f9c27dfa", - "sha256:9ae4ef0b3f6b41bad6366fb0ea4fc1d7ed051528e113a60fa2a65a9abb5b1d99", - "sha256:9c98230f5042f4945f957d006edccc2af1e03ed5e37ce7c373f00a5a4daa6149", - "sha256:9fa2566ca27d67c86569e8c85297aaf413ffab85a8960500f12ea34ff98e4c41", - "sha256:a14969b8691f7998e74663b77b4c36c0337cb1df552da83d5c9004a93afdb574", - "sha256:a8aacce6e2e1edcb6ac625fb0f8c3a9570ccc7bfba1f63419b3769ccf6a00ed0", - "sha256:a8e538f46104c815be19c975572d74afb53f29650ea2025bbfaef359d2de2f7f", - "sha256:aa41e526a5d4a9dfcfbab0716c7e8a1b215abd3f3df5a45cf18a12721d31cb5d", - "sha256:aa693779a8b50cd97570e5a0f343538a8dbd3e496fa5dcb87e29406ad0299654", - "sha256:ab22fbd9765e6954bc0bcff24c25ff71dcbfdb185fcdaca49e81bac68fe724d3", - "sha256:ab2e5bef076f5a235c3774b4f4028a680432cded7cad37bba0fd90d64b187d19", - "sha256:ab973df98fc99ab39080bfb0eb3a925181454d7c3ac8a1e695fddfae696d9e90", - "sha256:af73657b7a68211996527dbfeffbb0864e043d270580c5aef06dc4b659a4b578", - "sha256:b197e7094f232959f8f20541ead1d9862ac5ebea1d58e9849c1bf979255dfac9", - "sha256:b295729485b06c1a0683af02a9e42d2caa9db04a373dc38a6a58cdd1e8abddf1", - "sha256:b8831399554b92b72af5932cdbbd4ddc55c55f631bb13ff8fe4e6536a06c5c51", - "sha256:b8dcd239c743aa2f9c22ce674a145e0a25cb1566c495928440a181ca1ccf6719", - "sha256:bcb4f8ea87d03bc51ad04add8ceaf9b0f085ac045ab4d74e73bbc2dc033f0236", - "sha256:bd7af3717683bea4c87acd8c0d3d5b44d56120b26fd3f8a692bdd2d5260c620a", - "sha256:bf4475b82be41b07cc5e5ff94810e6a01f276e37c2d55571e3fe175e467a1a1c", - "sha256:c3e446d253bd88f6377260d07c895816ebf33ffffd56c1c792b13bff9c3e1ade", - "sha256:c57516e58fd17d03ebe67e181a4e4e2ccab1168f8c2976c6a334d4f819fe5944", - "sha256:c94057af19bc953643a33581844649a7fdab902624d2eb739738a30e2b3e60fc", - "sha256:cab5d0b79d987c67f3b9e9c53f54a61360422a5a0bc075f43cab5621d530c3b6", - "sha256:ce031db0408e487fd2775d745ce30a7cd2923667cf3b69d48d219f1d8f5ddeb6", - "sha256:cee4373f4d3ad28f1ab6290684d8e2ebdb9e7a1b74fdc39e4c211995f77bec27", - "sha256:d5b054862739d276e09928de37c79ddeec42a6e1bfc55863be96a36ba22926f6", - "sha256:dbe03226baf438ac4fda9e2d0715022fd579cb641c4cf639fa40d53b2fe6f3e2", - "sha256:dc15e99b2d8a656f8e666854404f1ba54765871104e50c8e9813af8a7db07f12", - "sha256:dcaf7c1524c0542ee2fc82cc8ec337f7a9f7edee2532421ab200d2b920fc97cf", - "sha256:dd4eda173a9fcccb5f2e2bd2a9f423d180194b1bf17cf59e3269899235b2a114", - "sha256:dd9a8bd8900e65504a305bf8ae6fa9fbc66de94178c420791d0293702fce2df7", - "sha256:de7376c29d95d6719048c194a9cf1a1b0393fbe8488a22008610b0361d834ecf", - "sha256:e7fdd52961feb4c96507aa649550ec2a0d527c086d284749b2f582f2d40a2e0d", - "sha256:e91f541a85298cf35433bf66f3fab2a4a2cff05c127eeca4af174f6d497f0d4b", - "sha256:e9e3c4c9e1ed40ea53acf11e2a386383c3304212c965773704e4603d589343ed", - "sha256:ee803480535c44e7f5ad00788526da7d85525cfefaf8acf8ab9a310000be4b03", - "sha256:f09cb5a7bbe1ecae6e87901a2eb23e0256bb524a79ccc53eb0b7629fbe7677c4", - "sha256:f19c1585933c82098c2a520f8ec1227f20e339e33aca8fa6f956f6691b784e67", - "sha256:f1a2f519ae173b5b6a2c9d5fa3116ce16e48b3462c8b96dfdded11055e3d6365", - "sha256:f28f891ccd15c514a0981f3b9db9aa23d62fe1a99997512b0491d2ed323d229a", - "sha256:f3e73a4255342d4eb26ef6df01e3962e73aa29baa3124a8e824c5d3364a65748", - "sha256:f606a1881d2663630ea5b8ce2efe2111740df4b687bd78b34a8131baa007f79b", - "sha256:fe9f97feb71aa9896b81973a7bbada8c49501dc73e58a10fcef6663af95e5079", - "sha256:ffc519621dce0c767e96b9c53f09c5d215578e10b02c285809f76509a3931482" - ], - "markers": "python_full_version >= '3.7.0'", - "version": "==3.4.0" - }, - "click": { - "hashes": [ - "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28", - "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de" - ], - "markers": "python_version >= '3.7'", - "version": "==8.1.7" - }, - "dash": { - "hashes": [ - "sha256:0ce0479d1bc958e934630e2de7023b8a4558f23ce1f9f5a4b34b65eb3903a869", - "sha256:20e8404f73d0fe88ce2eae33c25bbc513cbe52f30d23a401fa5f24dbb44296c8" - ], - "index": "pypi", - "version": "==2.18.2" - }, - "dash-core-components": { - "hashes": [ - "sha256:52b8e8cce13b18d0802ee3acbc5e888cb1248a04968f962d63d070400af2e346", - "sha256:c6733874af975e552f95a1398a16c2ee7df14ce43fa60bb3718a3c6e0b63ffee" - ], - "version": "==2.0.0" - }, - "dash-html-components": { - "hashes": [ - "sha256:8703a601080f02619a6390998e0b3da4a5daabe97a1fd7a9cebc09d015f26e50", - "sha256:b42cc903713c9706af03b3f2548bda4be7307a7cf89b7d6eae3da872717d1b63" - ], - "version": "==2.0.0" - }, - "dash-table": { - "hashes": [ - "sha256:18624d693d4c8ef2ddec99a6f167593437a7ea0bf153aa20f318c170c5bc7308", - "sha256:19036fa352bb1c11baf38068ec62d172f0515f73ca3276c79dee49b95ddc16c9" - ], - "version": "==5.0.0" - }, "distlib": { "hashes": [ "sha256:47f8c22fd27c27e25a65601af709b38e4f0a45ea4fc2e710f65755fa8caaaf87", @@ -319,14 +163,6 @@ "markers": "python_version >= '3.8'", "version": "==3.16.1" }, - "flask": { - "hashes": [ - "sha256:34e815dfaa43340d1d15a5c3a02b8476004037eb4840b34910c6e21679d288f3", - "sha256:ceb27b0af3823ea2737928a4d99d125a06175b8512c445cbd9a9ce200ef76842" - ], - "markers": "python_version >= '3.8'", - "version": "==3.0.3" - }, "identify": { "hashes": [ "sha256:62f5dae9b5fef52c84cc188514e9ea4f3f636b1d8799ab5ebc475471f9e47a02", @@ -335,121 +171,15 @@ "markers": "python_version >= '3.9'", "version": "==2.6.3" }, - "idna": { - "hashes": [ - "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9", - "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3" - ], - "markers": "python_version >= '3.6'", - "version": "==3.10" - }, - "importlib-metadata": { - "hashes": [ - "sha256:45e54197d28b7a7f1559e60b95e7c567032b602131fbd588f1497f47880aa68b", - "sha256:71522656f0abace1d072b9e5481a48f07c138e00f079c38c8f883823f9c26bd7" - ], - "markers": "python_version >= '3.8'", - "version": "==8.5.0" - }, - "itsdangerous": { - "hashes": [ - "sha256:c6242fc49e35958c8b15141343aa660db5fc54d4f13a1db01a3f5891b98700ef", - "sha256:e0050c0b7da1eea53ffaf149c0cfbb5c6e2e2b69c4bef22c81fa6eb73e5f6173" - ], - "markers": "python_version >= '3.8'", - "version": "==2.2.0" - }, - "jinja2": { - "hashes": [ - "sha256:4a3aee7acbbe7303aede8e9648d13b8bf88a429282aa6122a993f0ac800cb369", - "sha256:bc5dd2abb727a5319567b7a813e6a2e7318c39f4f487cfe6c89c6f9c7d25197d" - ], - "markers": "python_version >= '3.7'", - "version": "==3.1.4" - }, - "markupsafe": { - "hashes": [ - "sha256:0bff5e0ae4ef2e1ae4fdf2dfd5b76c75e5c2fa4132d05fc1b0dabcd20c7e28c4", - "sha256:0f4ca02bea9a23221c0182836703cbf8930c5e9454bacce27e767509fa286a30", - "sha256:1225beacc926f536dc82e45f8a4d68502949dc67eea90eab715dea3a21c1b5f0", - "sha256:131a3c7689c85f5ad20f9f6fb1b866f402c445b220c19fe4308c0b147ccd2ad9", - "sha256:15ab75ef81add55874e7ab7055e9c397312385bd9ced94920f2802310c930396", - "sha256:1a9d3f5f0901fdec14d8d2f66ef7d035f2157240a433441719ac9a3fba440b13", - "sha256:1c99d261bd2d5f6b59325c92c73df481e05e57f19837bdca8413b9eac4bd8028", - "sha256:1e084f686b92e5b83186b07e8a17fc09e38fff551f3602b249881fec658d3eca", - "sha256:2181e67807fc2fa785d0592dc2d6206c019b9502410671cc905d132a92866557", - "sha256:2cb8438c3cbb25e220c2ab33bb226559e7afb3baec11c4f218ffa7308603c832", - "sha256:3169b1eefae027567d1ce6ee7cae382c57fe26e82775f460f0b2778beaad66c0", - "sha256:3809ede931876f5b2ec92eef964286840ed3540dadf803dd570c3b7e13141a3b", - "sha256:38a9ef736c01fccdd6600705b09dc574584b89bea478200c5fbf112a6b0d5579", - "sha256:3d79d162e7be8f996986c064d1c7c817f6df3a77fe3d6859f6f9e7be4b8c213a", - "sha256:444dcda765c8a838eaae23112db52f1efaf750daddb2d9ca300bcae1039adc5c", - "sha256:48032821bbdf20f5799ff537c7ac3d1fba0ba032cfc06194faffa8cda8b560ff", - "sha256:4aa4e5faecf353ed117801a068ebab7b7e09ffb6e1d5e412dc852e0da018126c", - "sha256:52305740fe773d09cffb16f8ed0427942901f00adedac82ec8b67752f58a1b22", - "sha256:569511d3b58c8791ab4c2e1285575265991e6d8f8700c7be0e88f86cb0672094", - "sha256:57cb5a3cf367aeb1d316576250f65edec5bb3be939e9247ae594b4bcbc317dfb", - "sha256:5b02fb34468b6aaa40dfc198d813a641e3a63b98c2b05a16b9f80b7ec314185e", - "sha256:6381026f158fdb7c72a168278597a5e3a5222e83ea18f543112b2662a9b699c5", - "sha256:6af100e168aa82a50e186c82875a5893c5597a0c1ccdb0d8b40240b1f28b969a", - "sha256:6c89876f41da747c8d3677a2b540fb32ef5715f97b66eeb0c6b66f5e3ef6f59d", - "sha256:6e296a513ca3d94054c2c881cc913116e90fd030ad1c656b3869762b754f5f8a", - "sha256:70a87b411535ccad5ef2f1df5136506a10775d267e197e4cf531ced10537bd6b", - "sha256:7e94c425039cde14257288fd61dcfb01963e658efbc0ff54f5306b06054700f8", - "sha256:846ade7b71e3536c4e56b386c2a47adf5741d2d8b94ec9dc3e92e5e1ee1e2225", - "sha256:88416bd1e65dcea10bc7569faacb2c20ce071dd1f87539ca2ab364bf6231393c", - "sha256:88b49a3b9ff31e19998750c38e030fc7bb937398b1f78cfa599aaef92d693144", - "sha256:8c4e8c3ce11e1f92f6536ff07154f9d49677ebaaafc32db9db4620bc11ed480f", - "sha256:8e06879fc22a25ca47312fbe7c8264eb0b662f6db27cb2d3bbbc74b1df4b9b87", - "sha256:9025b4018f3a1314059769c7bf15441064b2207cb3f065e6ea1e7359cb46db9d", - "sha256:93335ca3812df2f366e80509ae119189886b0f3c2b81325d39efdb84a1e2ae93", - "sha256:9778bd8ab0a994ebf6f84c2b949e65736d5575320a17ae8984a77fab08db94cf", - "sha256:9e2d922824181480953426608b81967de705c3cef4d1af983af849d7bd619158", - "sha256:a123e330ef0853c6e822384873bef7507557d8e4a082961e1defa947aa59ba84", - "sha256:a904af0a6162c73e3edcb969eeeb53a63ceeb5d8cf642fade7d39e7963a22ddb", - "sha256:ad10d3ded218f1039f11a75f8091880239651b52e9bb592ca27de44eed242a48", - "sha256:b424c77b206d63d500bcb69fa55ed8d0e6a3774056bdc4839fc9298a7edca171", - "sha256:b5a6b3ada725cea8a5e634536b1b01c30bcdcd7f9c6fff4151548d5bf6b3a36c", - "sha256:ba8062ed2cf21c07a9e295d5b8a2a5ce678b913b45fdf68c32d95d6c1291e0b6", - "sha256:ba9527cdd4c926ed0760bc301f6728ef34d841f405abf9d4f959c478421e4efd", - "sha256:bbcb445fa71794da8f178f0f6d66789a28d7319071af7a496d4d507ed566270d", - "sha256:bcf3e58998965654fdaff38e58584d8937aa3096ab5354d493c77d1fdd66d7a1", - "sha256:c0ef13eaeee5b615fb07c9a7dadb38eac06a0608b41570d8ade51c56539e509d", - "sha256:cabc348d87e913db6ab4aa100f01b08f481097838bdddf7c7a84b7575b7309ca", - "sha256:cdb82a876c47801bb54a690c5ae105a46b392ac6099881cdfb9f6e95e4014c6a", - "sha256:cfad01eed2c2e0c01fd0ecd2ef42c492f7f93902e39a42fc9ee1692961443a29", - "sha256:d16a81a06776313e817c951135cf7340a3e91e8c1ff2fac444cfd75fffa04afe", - "sha256:d8213e09c917a951de9d09ecee036d5c7d36cb6cb7dbaece4c71a60d79fb9798", - "sha256:e07c3764494e3776c602c1e78e298937c3315ccc9043ead7e685b7f2b8d47b3c", - "sha256:e17c96c14e19278594aa4841ec148115f9c7615a47382ecb6b82bd8fea3ab0c8", - "sha256:e444a31f8db13eb18ada366ab3cf45fd4b31e4db1236a4448f68778c1d1a5a2f", - "sha256:e6a2a455bd412959b57a172ce6328d2dd1f01cb2135efda2e4576e8a23fa3b0f", - "sha256:eaa0a10b7f72326f1372a713e73c3f739b524b3af41feb43e4921cb529f5929a", - "sha256:eb7972a85c54febfb25b5c4b4f3af4dcc731994c7da0d8a0b4a6eb0640e1d178", - "sha256:ee55d3edf80167e48ea11a923c7386f4669df67d7994554387f84e7d8b0a2bf0", - "sha256:f3818cb119498c0678015754eba762e0d61e5b52d34c8b13d770f0719f7b1d79", - "sha256:f8b3d067f2e40fe93e1ccdd6b2e1d16c43140e76f02fb1319a05cf2b79d99430", - "sha256:fcabf5ff6eea076f859677f5f0b6b5c1a51e70a376b0579e0eadef8db48c6b50" - ], - "markers": "python_version >= '3.9'", - "version": "==3.0.2" - }, "minio": { "hashes": [ "sha256:2a3fcf4ab753824de8ae3ffeb14da33d6ad416f83a7e82363a27b34da8e91f27", "sha256:4b63370ca83f82c23e6fb0a094a1e2b08b275884ae43f6a90c4388a45633e3f5" ], "index": "pypi", + "markers": "python_version >= '3.9'", "version": "==7.2.12" }, - "nest-asyncio": { - "hashes": [ - "sha256:6f172d5449aca15afd6c646851f4e31e02c598d553a667e38cafa997cfec55fe", - "sha256:87af6efd6b5e897c81050477ef65c62e2b2f35d51703cae01aff2905b1852e1c" - ], - "markers": "python_version >= '3.5'", - "version": "==1.6.0" - }, "nodeenv": { "hashes": [ "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f", @@ -458,14 +188,6 @@ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6'", "version": "==1.9.1" }, - "packaging": { - "hashes": [ - "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759", - "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f" - ], - "markers": "python_version >= '3.8'", - "version": "==24.2" - }, "platformdirs": { "hashes": [ "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907", @@ -474,29 +196,23 @@ "markers": "python_version >= '3.8'", "version": "==4.3.6" }, - "plotly": { - "hashes": [ - "sha256:dbc8ac8339d248a4bcc36e08a5659bacfe1b079390b8953533f4eb22169b4bae", - "sha256:f67073a1e637eb0dc3e46324d9d51e2fe76e9727c892dde64ddf1e1b51f29089" - ], - "markers": "python_version >= '3.8'", - "version": "==5.24.1" - }, "pre-commit": { "hashes": [ "sha256:80905ac375958c0444c65e9cebebd948b3cdb518f335a091a670a89d652139d2", "sha256:efde913840816312445dc98787724647c65473daefe420785f885e8ed9a06878" ], "index": "pypi", + "markers": "python_version >= '3.9'", "version": "==4.0.1" }, "prometheus-client": { "hashes": [ - "sha256:4fa6b4dd0ac16d58bb587c04b1caae65b8c5043e85f778f42f5f632f6af2e166", - "sha256:96c83c606b71ff2b0a433c98889d275f51ffec6c5e267de37c7a2b5c9aa9233e" + "sha256:252505a722ac04b0456be05c05f75f45d760c2911ffc45f2a06bcaed9f3ae3fb", + "sha256:594b45c410d6f4f8888940fe80b5cc2521b305a1fafe1c58609ef715a001f301" ], "index": "pypi", - "version": "==0.21.0" + "markers": "python_version >= '3.8'", + "version": "==0.21.1" }, "psycopg2-binary": { "hashes": [ @@ -569,6 +285,7 @@ "sha256:ffe8ed017e4ed70f68b7b371d84b7d4a790368db9203dfc2d222febd3a9c8863" ], "index": "pypi", + "markers": "python_version >= '3.8'", "version": "==2.9.10" }, "pyarrow": { @@ -617,6 +334,7 @@ "sha256:f96bd502cb11abb08efea6dab09c003305161cb6c9eafd432e35e76e7fa9b90c" ], "index": "pypi", + "markers": "python_version >= '3.9'", "version": "==18.1.0" }, "pycparser": { @@ -671,6 +389,7 @@ "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427" ], "index": "pypi", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'", "version": "==2.9.0.post0" }, "pytz": { @@ -740,51 +459,77 @@ "markers": "python_version >= '3.8'", "version": "==6.0.2" }, - "requests": { - "hashes": [ - "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760", - "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6" - ], - "markers": "python_version >= '3.8'", - "version": "==2.32.3" - }, - "retrying": { - "hashes": [ - "sha256:345da8c5765bd982b1d1915deb9102fd3d1f7ad16bd84a9700b85f64d24e8f3e", - "sha256:8cc4d43cb8e1125e0ff3344e9de678fefd85db3b750b81b2240dc0183af37b35" - ], - "version": "==1.3.4" - }, - "setuptools": { - "hashes": [ - "sha256:8199222558df7c86216af4f84c30e9b34a61d8ba19366cc914424cdbd28252f6", - "sha256:ce74b49e8f7110f9bf04883b730f4765b774ef3ef28f722cce7c273d253aaf7d" - ], - "markers": "python_version >= '3.9'", - "version": "==75.6.0" - }, "six": { "hashes": [ "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2'", "version": "==1.16.0" }, "sqlalchemy": { "hashes": [ - "sha256:91c54ca8345008fceaec987e10924bf07dcab36c442925357e5a467b36a38319" + "sha256:03e08af7a5f9386a43919eda9de33ffda16b44eb11f3b313e6822243770e9763", + "sha256:0572f4bd6f94752167adfd7c1bed84f4b240ee6203a95e05d1e208d488d0d436", + "sha256:07b441f7d03b9a66299ce7ccf3ef2900abc81c0db434f42a5694a37bd73870f2", + "sha256:1bc330d9d29c7f06f003ab10e1eaced295e87940405afe1b110f2eb93a233588", + "sha256:1e0d612a17581b6616ff03c8e3d5eff7452f34655c901f75d62bd86449d9750e", + "sha256:23623166bfefe1487d81b698c423f8678e80df8b54614c2bf4b4cfcd7c711959", + "sha256:2519f3a5d0517fc159afab1015e54bb81b4406c278749779be57a569d8d1bb0d", + "sha256:28120ef39c92c2dd60f2721af9328479516844c6b550b077ca450c7d7dc68575", + "sha256:37350015056a553e442ff672c2d20e6f4b6d0b2495691fa239d8aa18bb3bc908", + "sha256:39769a115f730d683b0eb7b694db9789267bcd027326cccc3125e862eb03bfd8", + "sha256:3c01117dd36800f2ecaa238c65365b7b16497adc1522bf84906e5710ee9ba0e8", + "sha256:3d6718667da04294d7df1670d70eeddd414f313738d20a6f1d1f379e3139a545", + "sha256:3dbb986bad3ed5ceaf090200eba750b5245150bd97d3e67343a3cfed06feecf7", + "sha256:4557e1f11c5f653ebfdd924f3f9d5ebfc718283b0b9beebaa5dd6b77ec290971", + "sha256:46331b00096a6db1fdc052d55b101dbbfc99155a548e20a0e4a8e5e4d1362855", + "sha256:4a121d62ebe7d26fec9155f83f8be5189ef1405f5973ea4874a26fab9f1e262c", + "sha256:4f5e9cd989b45b73bd359f693b935364f7e1f79486e29015813c338450aa5a71", + "sha256:50aae840ebbd6cdd41af1c14590e5741665e5272d2fee999306673a1bb1fdb4d", + "sha256:59b1ee96617135f6e1d6f275bbe988f419c5178016f3d41d3c0abb0c819f75bb", + "sha256:59b8f3adb3971929a3e660337f5dacc5942c2cdb760afcabb2614ffbda9f9f72", + "sha256:66bffbad8d6271bb1cc2f9a4ea4f86f80fe5e2e3e501a5ae2a3dc6a76e604e6f", + "sha256:69f93723edbca7342624d09f6704e7126b152eaed3cdbb634cb657a54332a3c5", + "sha256:6a440293d802d3011028e14e4226da1434b373cbaf4a4bbb63f845761a708346", + "sha256:72c28b84b174ce8af8504ca28ae9347d317f9dba3999e5981a3cd441f3712e24", + "sha256:79d2e78abc26d871875b419e1fd3c0bca31a1cb0043277d0d850014599626c2e", + "sha256:7f2767680b6d2398aea7082e45a774b2b0767b5c8d8ffb9c8b683088ea9b29c5", + "sha256:8318f4776c85abc3f40ab185e388bee7a6ea99e7fa3a30686580b209eaa35c08", + "sha256:8958b10490125124463095bbdadda5aa22ec799f91958e410438ad6c97a7b793", + "sha256:8c78ac40bde930c60e0f78b3cd184c580f89456dd87fc08f9e3ee3ce8765ce88", + "sha256:90812a8933df713fdf748b355527e3af257a11e415b613dd794512461eb8a686", + "sha256:9bc633f4ee4b4c46e7adcb3a9b5ec083bf1d9a97c1d3854b92749d935de40b9b", + "sha256:9e46ed38affdfc95d2c958de328d037d87801cfcbea6d421000859e9789e61c2", + "sha256:9fe53b404f24789b5ea9003fc25b9a3988feddebd7e7b369c8fac27ad6f52f28", + "sha256:a4e46a888b54be23d03a89be510f24a7652fe6ff660787b96cd0e57a4ebcb46d", + "sha256:a86bfab2ef46d63300c0f06936bd6e6c0105faa11d509083ba8f2f9d237fb5b5", + "sha256:ac9dfa18ff2a67b09b372d5db8743c27966abf0e5344c555d86cc7199f7ad83a", + "sha256:af148a33ff0349f53512a049c6406923e4e02bf2f26c5fb285f143faf4f0e46a", + "sha256:b11d0cfdd2b095e7b0686cf5fabeb9c67fae5b06d265d8180715b8cfa86522e3", + "sha256:b2985c0b06e989c043f1dc09d4fe89e1616aadd35392aea2844f0458a989eacf", + "sha256:b544ad1935a8541d177cb402948b94e871067656b3a0b9e91dbec136b06a2ff5", + "sha256:b5cc79df7f4bc3d11e4b542596c03826063092611e481fcf1c9dfee3c94355ef", + "sha256:b817d41d692bf286abc181f8af476c4fbef3fd05e798777492618378448ee689", + "sha256:b81ee3d84803fd42d0b154cb6892ae57ea6b7c55d8359a02379965706c7efe6c", + "sha256:be9812b766cad94a25bc63bec11f88c4ad3629a0cec1cd5d4ba48dc23860486b", + "sha256:c245b1fbade9c35e5bd3b64270ab49ce990369018289ecfde3f9c318411aaa07", + "sha256:c3f3631693003d8e585d4200730616b78fafd5a01ef8b698f6967da5c605b3fa", + "sha256:c4ae3005ed83f5967f961fd091f2f8c5329161f69ce8480aa8168b2d7fe37f06", + "sha256:c54a1e53a0c308a8e8a7dffb59097bff7facda27c70c286f005327f21b2bd6b1", + "sha256:d0ddd9db6e59c44875211bc4c7953a9f6638b937b0a88ae6d09eb46cced54eff", + "sha256:dc022184d3e5cacc9579e41805a681187650e170eb2fd70e28b86192a479dcaa", + "sha256:e32092c47011d113dc01ab3e1d3ce9f006a47223b18422c5c0d150af13a00687", + "sha256:f7b64e6ec3f02c35647be6b4851008b26cff592a95ecb13b6788a54ef80bbdd4", + "sha256:f942a799516184c855e1a32fbc7b29d7e571b52612647866d4ec1c3242578fcb", + "sha256:f9511d8dd4a6e9271d07d150fb2f81874a3c8c95e11ff9af3a2dfc35fe42ee44", + "sha256:fd3a55deef00f689ce931d4d1b23fa9f04c880a48ee97af488fd215cf24e2a6c", + "sha256:fddbe92b4760c6f5d48162aef14824add991aeda8ddadb3c31d56eb15ca69f8e", + "sha256:fdf3386a801ea5aba17c6410dd1dc8d39cf454ca2565541b5ac42a84e1e28f53" ], "index": "pypi", - "version": "==1.3.3" - }, - "tenacity": { - "hashes": [ - "sha256:807f37ca97d62aa361264d497b0e31e92b8027044942bfa756160d908320d73b", - "sha256:93de0c98785b27fcf659856aa9f54bfbd399e29969b0621bc7f762bd441b4539" - ], - "markers": "python_version >= '3.8'", - "version": "==9.0.0" + "markers": "python_version >= '3.7'", + "version": "==2.0.36" }, "typing-extensions": { "hashes": [ @@ -809,22 +554,6 @@ ], "markers": "python_version >= '3.8'", "version": "==20.28.0" - }, - "werkzeug": { - "hashes": [ - "sha256:1bc0c2310d2fbb07b1dd1105eba2f7af72f322e1e455f2f93c993bee8c8a5f17", - "sha256:a8dd59d4de28ca70471a34cba79bed5f7ef2e036a76b3ab0835474246eb41f8d" - ], - "markers": "python_version >= '3.8'", - "version": "==3.0.6" - }, - "zipp": { - "hashes": [ - "sha256:2c9958f6430a2040341a52eb608ed6dd93ef4392e02ffe219417c1b28b5dd1f4", - "sha256:ac1bbe05fd2991f160ebce24ffbac5f6d11d83dc90891255885223d42b3cd931" - ], - "markers": "python_version >= '3.9'", - "version": "==3.21.0" } }, "develop": {} diff --git a/app.py b/app.py deleted file mode 100755 index a092dd3..0000000 --- a/app.py +++ /dev/null @@ -1,62 +0,0 @@ -import logging -import sys - -import dash -import dash_core_components as dcc -import dash_html_components as html -from kokudaily.charts import display_engineering -from kokudaily.charts import display_index -from kokudaily.charts import display_marketing -from kokudaily.config import Config - -root = logging.getLogger() -root.setLevel(logging.INFO) - -handler = logging.StreamHandler(sys.stdout) -handler.setLevel(logging.INFO) -formatter = logging.Formatter( - "%(asctime)s - %(name)s - %(levelname)s - %(message)s" -) -handler.setFormatter(formatter) -root.addHandler(handler) - -LOG = logging.getLogger(__name__) -CSS = ["https://codepen.io/chriddyp/pen/bWLwgP.css"] - -CHART_PATHS = { - "/": {"name": "Index", "view": display_index}, - "/marketing": {"name": "Marketing", "view": display_marketing}, - "/engineering": {"name": "Engineering", "view": display_engineering}, -} - - -LOG.info("Starting server.") -app = dash.Dash(__name__, external_stylesheets=CSS) - -div_list = [] -# represents the URL bar, doesn't render anything -div_list.append(dcc.Location(id="url", refresh=False)) - -for key, value in CHART_PATHS.items(): - div_list.append(dcc.Link(value.get("name", "Missing Link Name"), href=key)) - div_list.append(html.Br()) - -# content will be rendered in this element -div_list.append(html.Div(id="page-content")) -app.layout = html.Div(div_list) - - -@app.callback( - dash.dependencies.Output("page-content", "children"), - [dash.dependencies.Input("url", "pathname")], -) -def display_page(pathname): - LOG.info(f"Hitting path {pathname}.") - view = CHART_PATHS.get(pathname, {}).get("view") - if view: - return view() - else: - return html.Div([html.H3(f"Unknown page {pathname}")]) - - -app.run_server(debug=True, host=Config.APP_HOST, port=Config.APP_PORT) diff --git a/kokudaily/charts/__init__.py b/kokudaily/charts/__init__.py deleted file mode 100644 index 09c6e08..0000000 --- a/kokudaily/charts/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from .engineering import display_engineering # noqa -from .index import display_index # noqa -from .marketing import display_marketing # noqa diff --git a/kokudaily/charts/engineering.py b/kokudaily/charts/engineering.py deleted file mode 100644 index 3a3c44f..0000000 --- a/kokudaily/charts/engineering.py +++ /dev/null @@ -1,23 +0,0 @@ -import logging - -import dash_html_components as html -from kokudaily.charts.utils import generate_table -from kokudaily.reports import run_reports - -LOG = logging.getLogger(__name__) - - -def display_engineering(): - """Display engineering metrics.""" - LOG.info("Displaying engineering metrics.") - - report_data = run_reports(filter_target="engineering") - eng_metrics = report_data.get("engineering", {}) - page_div = [html.H3("Engineering")] - for report_name, report_data in eng_metrics.items(): - columns = report_data.get("columns", []) - data = report_data.get("data", []) - page_div.append(html.H4(report_name)) - page_div.append(generate_table(columns, data)) - - return html.Div(page_div) diff --git a/kokudaily/charts/index.py b/kokudaily/charts/index.py deleted file mode 100644 index 9f41fbe..0000000 --- a/kokudaily/charts/index.py +++ /dev/null @@ -1,6 +0,0 @@ -import dash_html_components as html - - -def display_index(): - """Display index metrics.""" - return html.Div([html.H3("Welcome to live Cost Metrics!")]) diff --git a/kokudaily/charts/marketing.py b/kokudaily/charts/marketing.py deleted file mode 100644 index 86646a3..0000000 --- a/kokudaily/charts/marketing.py +++ /dev/null @@ -1,23 +0,0 @@ -import logging - -import dash_html_components as html -from kokudaily.charts.utils import generate_table -from kokudaily.reports import run_reports - -LOG = logging.getLogger(__name__) - - -def display_marketing(): - """Display marketing metrics.""" - LOG.info("Displaying marketing metrics.") - - report_data = run_reports(filter_target="marketing") - mkt_metrics = report_data.get("marketing", {}) - page_div = [html.H3("Marketing")] - for report_name, report_data in mkt_metrics.items(): - columns = report_data.get("columns", []) - data = report_data.get("data", []) - page_div.append(html.H4(report_name)) - page_div.append(generate_table(columns, data)) - - return html.Div(page_div) diff --git a/kokudaily/charts/utils.py b/kokudaily/charts/utils.py deleted file mode 100644 index d969390..0000000 --- a/kokudaily/charts/utils.py +++ /dev/null @@ -1,15 +0,0 @@ -import dash_html_components as html - - -def generate_table(columns, rows): - return html.Table( - [ - html.Thead(html.Tr([html.Th(col) for col in columns])), - html.Tbody( - [ - html.Tr([html.Td(str(rows[i][col])) for col in columns]) - for i in range(len(rows)) - ] - ), - ] - ) diff --git a/kokudaily/reports.py b/kokudaily/reports.py index 7627847..10c28ea 100644 --- a/kokudaily/reports.py +++ b/kokudaily/reports.py @@ -8,6 +8,7 @@ from kokudaily.config import Config from kokudaily.engine import DB_ENGINE from pytz import UTC +from sqlalchemy import text LOG = logging.getLogger(__name__) USAGE_REPORT_PARAMS = { @@ -379,7 +380,7 @@ def _read_sql(filename): if os.path.exists(data_file) and os.path.isfile(data_file): with open(data_file) as file: data = file.read() - return data + return text(data) def run_reports(filter_target=None): @@ -440,7 +441,7 @@ def run_reports(filter_target=None): for row in rs: writer.writerow(row) data.append(row) - data_dicts.append(dict(row)) + data_dicts.append(row._asdict()) target_obj = report_data.get(target, {}) target_obj[report_name] = { "data": data, diff --git a/kokudaily/sql/cust_cost_model_report_setup.sql b/kokudaily/sql/cust_cost_model_report_setup.sql index aa5c728..9d68e13 100644 --- a/kokudaily/sql/cust_cost_model_report_setup.sql +++ b/kokudaily/sql/cust_cost_model_report_setup.sql @@ -33,7 +33,7 @@ INSERT provider_id, cluster_id ) -SELECT ''%%1$s'' AS "customer", +SELECT ''%1$s'' AS "customer", cm.uuid AS "cost_model_id", cm.source_type AS "source_type", cm.created_timestamp AS "created_timestamp", @@ -44,9 +44,9 @@ SELECT ''%%1$s'' AS "customer", map.cost_model_id AS "cost_model_map_id", p.uuid AS "provider_id", auth.credentials->>''cluster_id'' AS "cluster_id" -FROM %%1$s.cost_model cm +FROM %1$s.cost_model cm -- use left join for provider mapping to keep unused cost models -LEFT JOIN %%1$s.cost_model_map map +LEFT JOIN %1$s.cost_model_map map ON map.cost_model_id = cm.uuid JOIN public.api_provider p ON p.uuid = map.provider_uuid diff --git a/kokudaily/sql/cust_node_report_setup.sql b/kokudaily/sql/cust_node_report_setup.sql index 9146d0b..f6941ea 100644 --- a/kokudaily/sql/cust_node_report_setup.sql +++ b/kokudaily/sql/cust_node_report_setup.sql @@ -55,12 +55,12 @@ BEGIN ON c.schema_name = t.schema_name JOIN public.api_provider p ON p.customer_id = c.id - AND p.type = any( %(provider_types)s ) + AND p.type = any( (:provider_types) ) WHERE t.schema_name ~ '^acct' OR t.schema_name ~ '^org' ORDER BY t.schema_name LOOP - EXECUTE format(stmt_tmpl, schema_rec.schema_name, %(start_time)s, %(end_time)s); + EXECUTE format(stmt_tmpl, schema_rec.schema_name, (:start_time), (:end_time)); END LOOP; END $BODY$ LANGUAGE plpgsql; diff --git a/kokudaily/sql/cust_size_report_setup.sql b/kokudaily/sql/cust_size_report_setup.sql index 5e5c5dd..b12f308 100644 --- a/kokudaily/sql/cust_size_report_setup.sql +++ b/kokudaily/sql/cust_size_report_setup.sql @@ -28,7 +28,7 @@ insert pvc_count, tag_count ) -select ''%%1$s'' as "customer", +select ''%1$s'' as "customer", rpp.provider_id as "provider_id", rpp.report_period_start::date as "report_month", count(distinct rpp.cluster_id) as "cluster_count", @@ -39,14 +39,14 @@ select ''%%1$s'' as "customer", max(rpml.tag_count) as "tag_count" -- count(*) as "raw_lineitem_count" -- starting with line item as we need the data ingestion counts - from %%1$s.reporting_ocpusagereportperiod rpp - join %%1$s.reporting_ocp_clusters c + from %1$s.reporting_ocpusagereportperiod rpp + join %1$s.reporting_ocp_clusters c on rpp.cluster_id = c.cluster_id - join %%1$s.reporting_ocp_nodes n + join %1$s.reporting_ocp_nodes n on c.uuid = n.cluster_id - join %%1$s.reporting_ocp_projects p + join %1$s.reporting_ocp_projects p on c.uuid = p.cluster_id - join %%1$s.reporting_ocp_pvcs pvc + join %1$s.reporting_ocp_pvcs pvc on c.uuid = pvc.cluster_id -- transformations to get tag counts join ( @@ -59,14 +59,14 @@ select ''%%1$s'' as "customer", select distinct ruls.report_period_id, key || ''|'' || uv.value as "tag" - from %%1$s.reporting_ocpusagepodlabel_summary ruls + from %1$s.reporting_ocpusagepodlabel_summary ruls left join lateral (select unnest(ruls.values)) as uv(value) on true union select distinct rsls.report_period_id, key || ''|'' || sv.value as "tag" - from %%1$s.reporting_ocpstoragevolumelabel_summary rsls + from %1$s.reporting_ocpstoragevolumelabel_summary rsls left join lateral (select unnest(rsls.values)) as sv(value) on true ) rpta(report_period_id, tag) @@ -74,8 +74,8 @@ select ''%%1$s'' as "customer", by rpta.report_period_id ) as rpml(report_period_id, tag_count) on rpml.report_period_id = rpp.id - where rpp.report_period_start < ''%%3$s''::timestamptz -- start must be < end bounds as end bounds is start of next month - and rpp.report_period_start >= ''%%2$s''::timestamptz -- end must be >= start bounds + where rpp.report_period_start < ''%3$s''::timestamptz -- start must be < end bounds as end bounds is start of next month + and rpp.report_period_start >= ''%2$s''::timestamptz -- end must be >= start bounds group by "customer", rpp."provider_id", @@ -91,12 +91,12 @@ begin on c.schema_name = t.schema_name join public.api_provider p on p.customer_id = c.id - and p."type" = any( %(provider_types)s ) + and p."type" = any( (:provider_types) ) where t.schema_name ~ '^acct' or t.schema_name ~ '^org' order by t.schema_name loop - execute format(stmt_tmpl, schema_rec.schema_name, %(start_time)s, %(end_time)s); + execute format(stmt_tmpl, schema_rec.schema_name, (:start_time), (:end_time)); end loop; end $BODY$ language plpgsql; diff --git a/kokudaily/sql/cust_tag_report_setup.sql b/kokudaily/sql/cust_tag_report_setup.sql index e5341db..8c26602 100644 --- a/kokudaily/sql/cust_tag_report_setup.sql +++ b/kokudaily/sql/cust_tag_report_setup.sql @@ -23,21 +23,21 @@ insert ) with cte_openshift_label_count AS ( select count(distinct key) as key_count - from %%1$s.reporting_ocptags_values + from %1$s.reporting_ocptags_values ), cte_aws_tag_count AS ( select count(distinct key) as key_count - from %%1$s.reporting_awstags_values + from %1$s.reporting_awstags_values ), cte_azure_tag_count AS ( select count(distinct key) as key_count - from %%1$s.reporting_azuretags_values + from %1$s.reporting_azuretags_values ), cte_gcp_label_count AS ( select count(distinct key) as key_count - from %%1$s.reporting_gcptags_values + from %1$s.reporting_gcptags_values ) - select ''%%1$s'' as "customer", + select ''%1$s'' as "customer", ocp.key_count as openshift_label_key_count, aws.key_count as aws_tag_key_count, azure.key_count as azure_tag_key_count, diff --git a/kokudaily/sql/key_metrics/cust_cloud_costs_data_setup.sql b/kokudaily/sql/key_metrics/cust_cloud_costs_data_setup.sql index 5b59828..e1d124b 100644 --- a/kokudaily/sql/key_metrics/cust_cloud_costs_data_setup.sql +++ b/kokudaily/sql/key_metrics/cust_cloud_costs_data_setup.sql @@ -29,26 +29,26 @@ INSERT INTO __cust_cloud_cost_report ( ) WITH schemas AS ( SELECT - ''%%1$s'' AS "customer", - generate_series(date_trunc(''month'', ''%%2$s''::date), now(), ''1 day'')::date AS "date" + ''%1$s'' AS "customer", + generate_series(date_trunc(''month'', ''%2$s''::date), now(), ''1 day'')::date AS "date" ), aws_costs_currencies AS ( SELECT - ''%%1$s'' AS "customer", + ''%1$s'' AS "customer", usage_start AS "date", SUM(unblended_cost) AS "unblended_cost", SUM(calculated_amortized_cost) AS "calculated_amortized_cost", currency_code AS "currency" FROM - %%1$s.reporting_aws_cost_summary_p + %1$s.reporting_aws_cost_summary_p WHERE - usage_start >= ''%%2$s''::date - AND usage_start < ''%%3$s''::date + usage_start >= ''%2$s''::date + AND usage_start < ''%3$s''::date GROUP BY currency, usage_start ), aws_costs AS ( SELECT - ''%%1$s'' AS "customer", + ''%1$s'' AS "customer", date AS "date", SUM(unblended_cost / pae.exchange_rate) AS "aws_unblended_cost", SUM(calculated_amortized_cost / pae.exchange_rate) AS "aws_calculated_amortized_cost" @@ -58,20 +58,20 @@ aws_costs AS ( ), azure_costs_currencies AS ( SELECT - ''%%1$s'' AS "customer", + ''%1$s'' AS "customer", usage_start AS "date", SUM(pretax_cost) AS "pretax_cost", currency AS "currency" FROM - %%1$s.reporting_azure_cost_summary_p + %1$s.reporting_azure_cost_summary_p WHERE - usage_start >= ''%%2$s''::date - AND usage_start < ''%%3$s''::date + usage_start >= ''%2$s''::date + AND usage_start < ''%3$s''::date GROUP BY currency, usage_start ), azure_costs AS ( SELECT - ''%%1$s'' AS "customer", + ''%1$s'' AS "customer", date AS "date", SUM(pretax_cost / pae.exchange_rate) AS "azure_pretax_cost" FROM azure_costs_currencies azcc @@ -80,21 +80,21 @@ azure_costs AS ( ), gcp_costs_currencies AS ( SELECT - ''%%1$s'' AS "customer", + ''%1$s'' AS "customer", usage_start AS "date", SUM(unblended_cost) AS "unblended_cost", SUM(credit_amount) AS "credit_amount", currency AS "currency" FROM - %%1$s.reporting_gcp_cost_summary_p + %1$s.reporting_gcp_cost_summary_p WHERE - usage_start >= ''%%2$s''::date - AND usage_start < ''%%3$s''::date + usage_start >= ''%2$s''::date + AND usage_start < ''%3$s''::date GROUP BY currency, usage_start ), gcp_costs AS ( SELECT - ''%%1$s'' AS "customer", + ''%1$s'' AS "customer", date AS "date", SUM(unblended_cost / pae.exchange_rate) AS "gcp_unblended_cost", SUM(unblended_cost / pae.exchange_rate + credit_amount / pae.exchange_rate) AS "gcp_total" @@ -104,20 +104,20 @@ gcp_costs AS ( ), oci_costs_currencies AS ( SELECT - ''%%1$s'' AS "customer", + ''%1$s'' AS "customer", usage_start AS "date", SUM(cost) AS "cost", currency AS "currency" FROM - %%1$s.reporting_oci_cost_summary_p + %1$s.reporting_oci_cost_summary_p WHERE - usage_start >= ''%%2$s''::date - AND usage_start < ''%%3$s''::date + usage_start >= ''%2$s''::date + AND usage_start < ''%3$s''::date GROUP BY currency, usage_start ), oci_costs AS ( SELECT - ''%%1$s'' AS "customer", + ''%1$s'' AS "customer", date AS "date", SUM(cost / pae.exchange_rate) AS "oci_cost" FROM oci_costs_currencies oc @@ -154,6 +154,6 @@ BEGIN ORDER BY t.schema_name LOOP - EXECUTE format(stmt_tmpl, schema_rec.schema_name, %(start_time)s, %(end_time)s); + EXECUTE format(stmt_tmpl, schema_rec.schema_name, (:start_time), (:end_time)); END LOOP; END $BODY$ LANGUAGE plpgsql; diff --git a/kokudaily/sql/key_metrics/cust_openshift_costs_data_setup.sql b/kokudaily/sql/key_metrics/cust_openshift_costs_data_setup.sql index 4fa0011..ea93890 100644 --- a/kokudaily/sql/key_metrics/cust_openshift_costs_data_setup.sql +++ b/kokudaily/sql/key_metrics/cust_openshift_costs_data_setup.sql @@ -37,25 +37,25 @@ INSERT INTO __cust_openshift_cost_report ( ) WITH schemas AS ( SELECT - ''%%1$s'' AS "customer", - generate_series(date_trunc(''month'', ''%%2$s''::date), now(), ''1 day'')::date AS "date" + ''%1$s'' AS "customer", + generate_series(date_trunc(''month'', ''%2$s''::date), now(), ''1 day'')::date AS "date" ), infra_raw_currencies AS ( SELECT - ''%%1$s'' AS "customer", + ''%1$s'' AS "customer", usage_start AS "date", SUM(infrastructure_raw_cost) AS "infrastructure_raw_cost", raw_currency AS "currency" FROM - %%1$s.reporting_ocp_cost_summary_p + %1$s.reporting_ocp_cost_summary_p WHERE - usage_start >= ''%%2$s''::date - AND usage_start < ''%%3$s''::date + usage_start >= ''%2$s''::date + AND usage_start < ''%3$s''::date GROUP BY raw_currency, usage_start ), infra_raw AS ( SELECT - ''%%1$s'' AS "customer", + ''%1$s'' AS "customer", date AS "date", SUM(infrastructure_raw_cost / pae.exchange_rate) AS "infrastructure_raw_cost" FROM infra_raw_currencies irc @@ -64,7 +64,7 @@ infra_raw AS ( ), infra_costs_grouped_by_source AS ( SELECT - ''%%1$s'' AS "customer", + ''%1$s'' AS "customer", usage_start AS "date", SUM(cost_model_cpu_cost) AS "cost_model_cpu_cost", SUM(cost_model_memory_cost) AS "cost_model_memory_cost", @@ -73,18 +73,18 @@ infra_costs_grouped_by_source AS ( source_uuid AS "provider_uuid", currency AS "currency" FROM - %%1$s.reporting_ocp_cost_summary_p - JOIN %%1$s.cost_model_map cmm ON cmm.provider_uuid = source_uuid - JOIN %%1$s.cost_model cm ON cm.uuid = cmm.cost_model_id + %1$s.reporting_ocp_cost_summary_p + JOIN %1$s.cost_model_map cmm ON cmm.provider_uuid = source_uuid + JOIN %1$s.cost_model cm ON cm.uuid = cmm.cost_model_id WHERE - usage_start >= ''%%2$s''::date - AND usage_start < ''%%3$s''::date + usage_start >= ''%2$s''::date + AND usage_start < ''%3$s''::date AND cost_model_rate_type=''Infrastructure'' GROUP BY source_uuid, currency, usage_start ), infra_costs AS ( SELECT - ''%%1$s'' AS "customer", + ''%1$s'' AS "customer", date AS "date", SUM(cost_model_cpu_cost / pae.exchange_rate) AS "infra_cost_model_cpu_cost", SUM(cost_model_memory_cost / pae.exchange_rate) AS "infra_cost_model_memory_cost", @@ -96,7 +96,7 @@ infra_costs AS ( ), sup_costs_grouped_by_source AS ( SELECT - ''%%1$s'' AS "customer", + ''%1$s'' AS "customer", usage_start AS "date", SUM(cost_model_cpu_cost) AS "cost_model_cpu_cost", SUM(cost_model_memory_cost) AS "cost_model_memory_cost", @@ -105,18 +105,18 @@ sup_costs_grouped_by_source AS ( source_uuid AS "provider_uuid", currency AS "currency" FROM - %%1$s.reporting_ocp_cost_summary_p - JOIN %%1$s.cost_model_map cmm ON cmm.provider_uuid = source_uuid - JOIN %%1$s.cost_model cm ON cm.uuid = cmm.cost_model_id + %1$s.reporting_ocp_cost_summary_p + JOIN %1$s.cost_model_map cmm ON cmm.provider_uuid = source_uuid + JOIN %1$s.cost_model cm ON cm.uuid = cmm.cost_model_id WHERE - usage_start >= ''%%2$s''::date - AND usage_start < ''%%3$s''::date + usage_start >= ''%2$s''::date + AND usage_start < ''%3$s''::date AND cost_model_rate_type=''Supplementary'' GROUP BY source_uuid, currency, usage_start ), sup_costs AS ( SELECT - ''%%1$s'' AS "customer", + ''%1$s'' AS "customer", date AS "date", SUM(cost_model_cpu_cost / pae.exchange_rate) AS "sup_cost_model_cpu_cost", SUM(cost_model_memory_cost / pae.exchange_rate) AS "sup_cost_model_memory_cost", @@ -159,6 +159,6 @@ BEGIN ORDER BY t.schema_name LOOP - EXECUTE format(stmt_tmpl, schema_rec.schema_name, %(start_time)s, %(end_time)s); + EXECUTE format(stmt_tmpl, schema_rec.schema_name, (:start_time), (:end_time)); END LOOP; END $BODY$ LANGUAGE plpgsql; diff --git a/kokudaily/sql/key_metrics/cust_openshift_infra_data_setup.sql b/kokudaily/sql/key_metrics/cust_openshift_infra_data_setup.sql index c814772..8320d4a 100644 --- a/kokudaily/sql/key_metrics/cust_openshift_infra_data_setup.sql +++ b/kokudaily/sql/key_metrics/cust_openshift_infra_data_setup.sql @@ -57,8 +57,8 @@ INSERT INTO __cust_openshift_infra_report ( ) WITH schemas AS ( SELECT - ''%%1$s'' AS "customer", - generate_series(date_trunc(''month'', ''%%2$s''::date), now(), ''1 day'')::date AS "date" + ''%1$s'' AS "customer", + generate_series(date_trunc(''month'', ''%2$s''::date), now(), ''1 day'')::date AS "date" ), node_info as ( SELECT @@ -67,11 +67,11 @@ node_info as ( max(ropsbn.node_capacity_cpu_cores) AS node_capacity_cpu_cores, max(ropsbn.node_capacity_memory_gigabytes) AS node_capacity_memory_gigabytes, usage_start - FROM %%1$s.reporting_ocp_pod_summary_by_node_p ropsbn - LEFT JOIN %%1$s.reporting_ocp_nodes ron USING (node) + FROM %1$s.reporting_ocp_pod_summary_by_node_p ropsbn + LEFT JOIN %1$s.reporting_ocp_nodes ron USING (node) WHERE - usage_start >= ''%%2$s''::date - AND usage_start < ''%%3$s''::date + usage_start >= ''%2$s''::date + AND usage_start < ''%3$s''::date GROUP BY ron.node, ron.node_role, usage_start ORDER BY node_role, usage_start ), @@ -87,7 +87,7 @@ node_agg as( ), node_counts AS ( SELECT - ''%%1$s'' AS "customer", + ''%1$s'' AS "customer", SUM(CASE WHEN node_role = ''infra'' THEN role_count END) as "infra_node_count", SUM(CASE WHEN node_role IN (''master'', ''control-plane'') THEN role_count END) as "control_plane_node_count", SUM(CASE WHEN node_role = ''worker'' THEN role_count END) as "worker_node_count", @@ -102,7 +102,7 @@ node_counts AS ( ), compute AS ( SELECT - ''%%1$s'' AS "customer", + ''%1$s'' AS "customer", usage_start AS "date", cluster_id, count(distinct node) AS nodes, @@ -111,10 +111,10 @@ compute AS ( max(cluster_capacity_memory_gigabyte_hours)/24 AS "clus_cap_mem", max(cluster_capacity_memory_gigabyte_hours) AS "clus_cap_mem_hours" FROM - %%1$s.reporting_ocp_pod_summary_by_node_p + %1$s.reporting_ocp_pod_summary_by_node_p WHERE - usage_start >= ''%%2$s''::date - AND usage_start < ''%%3$s''::date + usage_start >= ''%2$s''::date + AND usage_start < ''%3$s''::date AND cost_model_rate_type IS NULL GROUP BY cluster_id, @@ -122,7 +122,7 @@ compute AS ( ), compute_agg AS ( SELECT - ''%%1$s'' AS "customer", + ''%1$s'' AS "customer", date AS "date", count(distinct cluster_id) AS cluster_count, sum(nodes) AS node_count, @@ -135,7 +135,7 @@ compute_agg AS ( ), storage AS ( SELECT - ''%%1$s'' AS "customer", + ''%1$s'' AS "customer", usage_start AS "date", cluster_id, persistentvolumeclaim, @@ -144,10 +144,10 @@ storage AS ( max(persistentvolumeclaim_capacity_gigabyte_months) * extract(days FROM date_trunc(''month'', usage_start) + ''1 month - 1 day''::interval) AS "pvc_cap_gb", sum(persistentvolumeclaim_capacity_gigabyte_months) AS "pvc_cap_gb_mo" FROM - %%1$s.reporting_ocp_volume_summary_p + %1$s.reporting_ocp_volume_summary_p WHERE - usage_start >= ''%%2$s''::date - AND usage_start < ''%%3$s''::date + usage_start >= ''%2$s''::date + AND usage_start < ''%3$s''::date AND cost_model_rate_type IS NULL GROUP BY cluster_id, @@ -156,7 +156,7 @@ storage AS ( ), storage_agg AS ( SELECT - ''%%1$s'' AS "customer", + ''%1$s'' AS "customer", date AS "date", count(persistentvolumeclaim) AS "pvc_count", sum(vol_req_gb) AS "volume_request_gb", @@ -209,6 +209,6 @@ BEGIN ORDER BY t.schema_name LOOP - EXECUTE format(stmt_tmpl, schema_rec.schema_name, %(start_time)s, %(end_time)s); + EXECUTE format(stmt_tmpl, schema_rec.schema_name, (:start_time), (:end_time)); END LOOP; END $BODY$ LANGUAGE plpgsql;