I’m trying to set up Snowalert locally but I’m getting the follwoing authentication error when I attempt to log in the the ui.
SnowAlert error
I’m following this guide: https://snowalert.readthedocs.io/en/latest/pages/start.html#tl-dr-usage. I have included the output of my setup below (I have masked any sensitive data but you can see that the setup appears to be successful). I’m currently using a trial of Snowflake however I think this should still work as Snowflake do not restrict access to anything during a trial.
I have also followed this guide: https://snowalert.readthedocs.io/en/latest/pages/authentication.html#authentication to set up OAuth for the WebUI authentication but the result is the same.
(base) user#MacBook-Pro SnowAlertDir % docker run -it snowsec/snowalert ./install
Starting installer for SnowAlert.
Snowflake account where SnowAlert can store data, rules, and results (URL or account name): <account_name>.<region>
Next, authenticate installer --
Snowflake username: <user_with_accountadmin>
Password [leave blank for SSO for authentication]:
Authenticating to Snowflake.. ✓
Use role accountadmin... ✓
Creating warehouse... ✓
Creating database... ✓
Creating role and user..... ✓
Granting role to user... ✓
Granting account level privileges to SA role.... ✓
Use database snowalert... ✓
Creating schemas..... ✓
Creating alerts & violations tables....... ✓
Creating standard UDTFs......... ✓
Creating standard data views...................... ✓
Retrieving sample data share(s)... ✓
Creating sample data view.... ✓
Creating sample alert...... ✓
Creating sample violation... ✓
Granting object level privileges to SA role.......... ✓
Would you like to integrate Jira with SnowAlert (y/N)? N
--- DB setup complete! Now, let's prep the runners... ---
The access key for SnowAlert's Snowflake account can have a passphrase, if you wish.
RSA key passphrase [blank for none, '.' for random]:
Additionally, you may use Amazon Web Services for encryption and audit.
Enter IAM KMS KeyId or 'alias/{KeyAlias}' [blank for none, '.' for new]:
Setting auth key on snowalert user... ✓
--- ...all done! Next, run... ---
cat <<END_OF_FILE > snowalert-<account_name>.envs
SNOWFLAKE_ACCOUNT=<account_name>
SA_USER=snowalert
SA_ROLE=snowalert
SA_DATABASE=snowalert
SA_WAREHOUSE=snowalert
REGION=<region>
PRIVATE_KEY=<private_key>
PRIVATE_KEY_PASSWORD=<private_key_password>
END_OF_FILE
### ...and then... ###
docker run --env-file snowalert-<account_name>.envs snowsec/snowalert ./run all
--- ...the end. ---
(base) user#MacBook-Pro SnowAlertDir % cat <<END_OF_FILE > snowalert-<account_name>.envs
SNOWFLAKE_ACCOUNT=<account_name>
SA_USER=snowalert
SA_ROLE=snowalert
SA_DATABASE=snowalert
SA_WAREHOUSE=snowalert
REGION=<region>
PRIVATE_KEY=<private_key>
PRIVATE_KEY_PASSWORD=<private_key_password>
END_OF_FILE
(base) user#MacBook-Pro SnowAlertDir % docker run --env-file snowalert-<account_name>.envs snowsec/snowalert ./run all
running in docker container-like environment
[8] STARTING RUN WITH ID b8e7410d922d4f049f6a591e49d6769e
[8] got command all
[8] Loaded 5 views, 1 were 'VIOLATION_QUERY' rules.
[8] NO_VIOLATION_QUERIES_IN_TOO_LONG_VIOLATION_QUERY processing...
[8] NO_VIOLATION_QUERIES_IN_TOO_LONG_VIOLATION_QUERY created 1 rows.
[8] NO_VIOLATION_QUERIES_IN_TOO_LONG_VIOLATION_QUERY metadata recorded.
[8] NO_VIOLATION_QUERIES_IN_TOO_LONG_VIOLATION_QUERY done.
[8] RUN metadata recorded.
[8] Loaded 5 views, 0 were 'VIOLATION_SUPPRESSION' rules.
[8] RUN metadata recorded.
[8] Loaded 5 views, 3 were 'ALERT_QUERY' rules.
[36] SNOWFLAKE_LOGIN_WITHOUT_MFA_ALERT_QUERY processing...
[37] SNOWFLAKE_RESOURCE_CREATION_ALERT_QUERY processing...
[35] ACTIVITY_BY_ADMIN_ALERT_QUERY processing...
[35] ACTIVITY_BY_ADMIN_ALERT_QUERY created 60, updated 0 rows.
[37] SNOWFLAKE_RESOURCE_CREATION_ALERT_QUERY created 46, updated 0 rows.
[36] SNOWFLAKE_LOGIN_WITHOUT_MFA_ALERT_QUERY created 1, updated 0 rows.
[37] SNOWFLAKE_RESOURCE_CREATION_ALERT_QUERY metadata recorded.
[37] SNOWFLAKE_RESOURCE_CREATION_ALERT_QUERY done.
[36] SNOWFLAKE_LOGIN_WITHOUT_MFA_ALERT_QUERY metadata recorded.
[36] SNOWFLAKE_LOGIN_WITHOUT_MFA_ALERT_QUERY done.
[35] ACTIVITY_BY_ADMIN_ALERT_QUERY metadata recorded.
[35] ACTIVITY_BY_ADMIN_ALERT_QUERY done.
[8] RUN metadata recorded.
[8] Loaded 5 views, 1 were 'ALERT_SUPPRESSION' rules.
[8] SINGLE_FACTOR_EXCEPTIONS_ALERT_SUPPRESSION processing...
[8] SINGLE_FACTOR_EXCEPTIONS_ALERT_SUPPRESSION updated 0 rows.
[8] SINGLE_FACTOR_EXCEPTIONS_ALERT_SUPPRESSION metadata recorded.
[8] SINGLE_FACTOR_EXCEPTIONS_ALERT_SUPPRESSION done.
[8] All suppressions done, 107 remaining alerts marked suppressed=FALSE.
[8] RUN metadata recorded.
[8] the correlation id for alert 8627bc91-486d-45e8-be49-0f44edf3eb38 is 1d3fd3cb266942a3b71c7cb99ccb73e6
[8] correlation id successfully updated
[8] the correlation id for alert c4599d23-21f7-4871-80b2-352b750c9624 is 1d3fd3cb266942a3b71c7cb99ccb73e6
[8] correlation id successfully updated
[8] the correlation id for alert 6d868097-4231-41f6-9792-c3f89ad81ab1 is 1d3fd3cb266942a3b71c7cb99ccb73e6
[8] correlation id successfully updated
[8] the correlation id for alert 82f58bfb-a67f-495b-be26-df9061146401 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 2eb609f6-e268-45e2-84d7-5f39fef560a0 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 4ab6f07b-2836-4af0-849c-43c7fe4d151a is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 55278c82-01ee-49b2-9115-69f200abdd82 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert a7a212fb-ab1e-4f50-bbb3-5d32d7efe153 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 08e7698d-08e3-43c8-8e75-caf7e3498556 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert fe560ffe-dd2d-4483-b2f4-5af976fd2ea3 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 63c8b009-6f31-43e0-bac1-e1b3fbf0ceab is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 7b4493ae-4e1c-4f65-b220-51e1ce73b5fb is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 5dfc74f5-d364-4b93-9495-86b374be496b is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert f5393538-4c9c-4e4d-9445-ea6c0d96ecd7 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert aab2adc1-7d7e-4e44-a3a2-d1073436d9a1 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert db4510dc-e30d-44d7-9a5a-8161f47d05b2 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 70455a96-9ffc-421a-81db-fde39e5484aa is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 8ecd1b8d-1624-47b9-b80e-59a4c71c34ca is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert c30cedd3-2877-4cb1-9fe4-37b21cb2c587 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 68c4b80e-3cb8-42ac-b5ee-2c6cc64222e0 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 2fb52f2f-9912-47ba-979a-e45735b85415 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 456a86bd-c076-46a4-bac3-aa06815f8d0e is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 157dc225-a71e-43f8-8b6c-997592d19e35 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 72690791-f3fa-4373-ba68-45894d18a231 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert ed348ad9-e881-408d-adb6-e9afc740294c is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert baa35662-d43a-4d24-9de0-3c1ef5ef35ac is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert cb8bea28-3cb1-4961-8f60-d5248a6e5faa is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert ad257631-ce8d-48d2-9fa8-f22812603071 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert a91a3954-ce30-4b9c-8757-338401ae43ef is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert b9b9b2f0-6c60-425c-9c56-cb61f50b31a7 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 7ca558b4-1627-49e1-9def-0bb6d220f4ad is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 2505e54a-fad9-425a-864c-d7c49d1ac6b4 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert fe99de0e-2b34-4d82-b782-1b3c64e421d7 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 1e1b6d28-2955-49d2-a005-021bd0cf72a9 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 84646cd5-8029-4f63-926e-16443aeba521 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 51faa771-2501-4cd3-805f-950917ebf0e2 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert fe2e4a18-1ab3-473a-bc16-2a9a76dde381 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 220e1b02-6b68-45bf-a37b-b005f263bd3a is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 4bfc5414-c737-4b99-ad77-d9e8641251f5 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 3c4e5fd2-89d8-4a61-8397-324ee52184cf is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert e7cd6d4e-a95d-47b6-abcf-2579e181559e is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 920352be-22df-4719-a465-bf4754a1bb58 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 6ee7242c-be90-45f3-b2ca-e89d42efcf2e is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert ca162a99-cae9-485b-a7f8-5c3038e052a4 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 96dcfa29-4def-47c3-8309-d9cc6310a9a6 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 2b3e26f9-89ad-4af0-bd0c-797a81b820bb is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 0bd5a42d-c4b8-4afa-95c0-88fa7be32749 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 4e847a0f-35c8-48c7-881f-5385c22ee155 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 0e754d10-3855-492a-9854-bdb2c6ddee41 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 5eb16c3d-3478-4c4b-8cb1-a0c2cd6a11a2 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 3dcd71a7-fecd-45f7-b91e-fe4834051a59 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 8d3d39af-fdd9-4323-9397-9230e20c4047 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert eae52907-5173-473f-8e4d-d2fccb37c458 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 7d52f4e9-2425-461b-8d1d-1aae27dbbfce is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 54a8b2b0-a09e-4d8e-a21d-cd7790df74fe is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert aaf79f3f-e662-42f4-8959-aa19310ea78b is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert f858a44f-49ab-44e6-90cb-f9bbd5a07bc0 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 4506ce31-aba8-47fa-a4a9-140435f36528 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 1eb9cea2-5742-4988-a675-ace0afe295f9 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert bded86d5-c2b7-45af-9d88-5b486630ec08 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 1131702d-d6be-4cc6-a5e3-a3bb67e5af9a is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 909af03e-f2fe-4ae5-948a-1b89de8ddedc is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert eb0d3125-ea33-4330-9fbd-9df59838f41a is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert fa1c9afc-47c0-4513-8e29-340c94981c4a is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert aa7ff1ef-4d65-4a58-bb2f-a5c681e815c8 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert fc4ba482-280a-40f2-9dae-9b2d0af65c1c is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 86ab7e61-f8e5-4b02-9136-c2fff675853c is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 0c4aa12a-2bed-4c3b-9f14-3025dd6c64e2 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert e2e540d6-73a1-4765-86d8-92317aaef6b9 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 642185c3-011c-4068-87f1-e12a6acb6148 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert d1fcc382-5f5f-4a98-b82c-f4b142c011f1 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert eba4a70d-3749-48cd-9ea8-55d38b2088bc is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 23d292cb-f524-43ed-a221-40c97926c462 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 63744b3e-363c-41f5-b62a-445b78270f3e is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 424eef11-9e71-4df0-8bea-2a2085e6e21e is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 0f84d715-7f21-49f1-91fc-7d1ae243dd17 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert aa3ee886-38e3-45ff-9b64-d1672448a845 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 1f10ba7b-4168-4787-b03e-caabc94cbf52 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert b3c4cc80-63c1-4381-8043-22cc5248b938 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 06716dbc-eb79-4ac2-bb0a-1a685b74f40f is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert ffbdc071-a702-4b13-9cc4-173ca767ae98 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert a987567f-f1cf-4b71-9520-640e3ac9e80d is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 67ffacf8-1b9e-491b-a340-e69cfc3c9146 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert cf3159b8-e5ec-4db4-9a4c-6699dc3dcafa is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert d93a0c07-5393-45da-b049-427986438d10 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert b83aa12e-ceda-4323-9692-f769fe6a00dd is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 894b2ffa-e41b-4df0-8bac-d6ec0bcb8f7b is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 940f2ff0-bd82-4810-a5d2-2788e133247c is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 213ad8ff-6fbd-4f31-ab6f-05d5c5aec8f4 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 8b3f057e-8ae3-4905-aebc-6f4efd5e24fb is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 66ea6986-8621-4ffd-8dc8-7fae279321c6 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 869f110c-17fb-44d8-9501-41cbb4c62e19 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 5303ca1f-b570-42d4-947b-939aa2be907e is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 004105cd-0527-4a80-93db-dc5b692691fb is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert afe10478-8d2e-4a5e-bfa7-ce0ab943519a is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 73134c5d-ed8b-45ef-8a37-71cdca663f15 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert a2d2694e-5147-4e83-bb7d-b21d932775a8 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert c72e7f15-32de-40b2-b011-5fb25180ada9 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert d0f7f04e-d9b0-4a5e-8a19-cc4d38881f9d is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 98c9a34a-25a5-49fe-8207-1f217872fcb4 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert ffa28e52-5690-4550-9c12-04a3207ae634 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 719bcd68-ba2a-48fd-bfe6-cfba4f7a49b9 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 7456645c-a31f-4398-9cad-08e1839d44f2 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert c92dc3f0-0f91-4886-8bed-db011eaaeb1b is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert d47ad1f3-cd60-42d7-8edd-53ac38abfdb4 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert 5d75463f-58ba-4bc2-9156-6d459bea4321 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] the correlation id for alert eeda9332-fd88-4786-b52c-d606f059bbe7 is e0aea44f593f4d4a9e8b104a996a2f45
[8] correlation id successfully updated
[8] Found 107 new alerts to handle.
(base) user#MacBook-Pro SnowAlertDir % docker run -it -p 8000:8000 --env-file snowalert-<account_name>.envs snowsec/snowalert-webui
[2022-03-11 09:55:32 +0000] [1] [INFO] Starting gunicorn 20.0.4
[2022-03-11 09:55:32 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
[2022-03-11 09:55:32 +0000] [1] [INFO] Using worker: sync
[2022-03-11 09:55:32 +0000] [10] [INFO] Booting worker with pid: 10
Related
I have an array:
Array
(
[0] => 9055954
[1] => 2736738
[2] => 1234
[3] => 2844725
)
I need to a where condition to select the ids form database table add_family whose id is not equal to any one of the value in array, I'm using codeigniter, how can I check it using for loop for where condition.
You don't really need to run a for loop to do this. You can simply check it by running a simple query which will select all records from table after excluding ids as specified in array:
$ignore_ids = [9055954, 2736738, 1234, 2844725];
$this->db->where_not_in('add_family', $ignore_ids);
I have an array of jsonb elements (jsonb[]), with id and text. To remove an element I could use:
UPDATE "Users" SET chats = array_remove(chats, '{"id": 2, "text": "my message"')
But I want to delete the message just by the id, cause getting the message will cost me another query.
Assuming missing information:
Your table has a PK called user_id.
You want to remove all elements with id = 2 across the whole table.
You don't want to touch other rows.
id is unique within each array of chats.
UPDATE "Users" u
SET chats = array_remove(u.chats, d.chat)
FROM (
SELECT user_id, chat
FROM "Users", unnest(chats) chat
WHERE chat->>'id' = '2'
) d
WHERE d.user_id = u.user_id;
The following explanation matches the extent of provided information in the question:
I have a SQL Server database and want to optimize my most commonly executed query.
The database is quite simple it tracks the status of delivery orders leaving my plant. for the purposes of this question let's assume that my DB only contains 4 tables, the first is the Delivery Master table, containing the delivery ID(int), type(tinyint), location(tinyint), and status(tinyint), the other three tables are lookup tables to correlate the numbers used for type, location, and status to a text string (e.g. Status: 1='Open', 2='Picking',3='On-Dock'...)
The most commonly executed query is the delivery summary (Which is on the main page of the web-application) it is a pivot of all Deliveries witht he row fields being the type and location and the column headings being status:
[Location] | [Type] | [1(Open)] | [2] | [3] | [4] | ...
----------------------------------------------------------
'LocationA' | 'TypeA' | 1 | 2 | 3 | 4 | ...
'LocationA' | 'TypeB' | 5 | 6 | 7 | 8 | ...
'LocationB' | 'TypeA' | 9 | 10 | 11 | 12 | ...
...
On average this query takes 100ms to run (Which is odd as much more complicated queries that perform date calculations on every row in the Master Table and aggregate on more fields with weighted averages take less time than this query which only counts rows)
When I look at the execution plan I see that over half of the execution time is spent performing a clustered index scan on a table that has 6 records (Type).
The warehouse (Location) table scans using a non-clustered index and takes up only 3% of the execution time (But that table is only 5 records, which I am sure makes a huge difference)
I created a nonclustered index on the type table but the query optimizer does not uses it even when I delete the old execution plan and force it to create a new one.
Here is the SQL that is being executed
SELECT TOP (500)
Warehouse, WarehouseDescrip, Type, TypeDescrip,
[1] AS Open_DO, [2] AS In_Process, [3] AS On_Dock, [4] AS Revision, [5] AS Complete
FROM
(SELECT
Static.Warehouse.Description AS WarehouseDescrip,
Static.DOType.Description AS TypeDescrip,
DOInfo.DOMaster.Status, DOInfo.DOMaster.DONum,
DOInfo.DOMaster.Type, DOInfo.DOMaster.Warehouse
FROM
DOInfo.DOMaster
INNER JOIN
Static.DOType ON DOInfo.DOMaster.Type = Static.DOType.ID
INNER JOIN
Static.Warehouse ON DOInfo.DOMaster.Warehouse = Static.Warehouse.ID
WHERE
(DOInfo.DOMaster.Status <> 6)) ps
PIVOT
(COUNT(DONum) FOR Status IN ([1], [2], [3], [4], [5])) AS pvt
ORDER BY
Warehouse ASC, Type ASC
Screenshot of the execution plan:
I have a table "BinaryTree" and it has 2 columns "CustomerID" and "ParentID".
Another table is "Customers" and it has columns ""CustomerID" and "Firstname".
I want to query data from these table and want to assign these data to Spacetree in Json format.
Please have a reference of below links :-
http://philogb.github.io/jit/static/v20/Jit/Examples/Spacetree/example1.code.html
http://philogb.github.io/jit/static/v20/Jit/Examples/Spacetree/example1.html
I want data something like below :-
Parentid CustomerID FirstName
1 34 Test1
1 64 Test2
1 46 Test3
34 45 Test4
34 102 Test5
64 22 Test6
46 54 Test7
So I can build json string and assign it to spacetree.
I would be good if it return data in order, means for a parentid it first return all its childrens.
and after that it returns childrens of these childerns one by one, so it is easy to build json string in proper format that spacetree wants.
Please let me know if further information needed.
Thanks in advance guys.
use inner join.
select BT.PARID,BT.CUSTID,CU.firstname
from BinaryTree BT INNER JOIN Customers CU on BT.CUSTID=CU.CUSTID
ORDER BY BT.PARID,BT.CUSTID
check the demo : http://sqlfiddle.com/#!3/1ffc1/1
The concept is simple:
User click "Send PM" button on one of ads.
Window pop up with "Title" box, "Message" box and send button.
Recipient sees a message with following info: "Sender Name", "Date Received", "Title" and "Message".
Recipient replies by filling: "Title" and "Message" and press reply.
Repeat step 3.
No IP will be stored.
Can you please give me an idea how to make a concise/efficient relational design?
Message table formate
Message
Id
UserID
Message
Send_DateTime
Title
Message_Id ( FK )- self referance
self referance is to keep the track of the whole chat.
for the first message its NULL and than onwards id of relative meesage
Id UserID Message Send_DateTime Title Message_Id ( FK )- self referance
1 1 test datetime tt Null
2 2 test1 datetime tt 1
3 1 test2 datetime tt 2
...
go on