[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Change table-schema to detect when there are no r
From: |
Christopher Baines |
Subject: |
branch master updated: Change table-schema to detect when there are no results |
Date: |
Thu, 08 Oct 2020 14:46:16 -0400 |
This is an automated email from the git hooks/post-receive script.
cbaines pushed a commit to branch master
in repository data-service.
The following commit(s) were added to refs/heads/master by this push:
new f1eb2d3 Change table-schema to detect when there are no results
f1eb2d3 is described below
commit f1eb2d3bd25e09b781a181c5bf17a2f36134fc25
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Thu Oct 8 17:36:21 2020 +0100
Change table-schema to detect when there are no results
This might give more insight to the [1] errors occuring for some builds.
1: error: couldn't find data for locale in ()
---
guix-data-service/model/utils.scm | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/guix-data-service/model/utils.scm
b/guix-data-service/model/utils.scm
index e6c4a2b..13947bd 100644
--- a/guix-data-service/model/utils.scm
+++ b/guix-data-service/model/utils.scm
@@ -115,19 +115,26 @@
lst))
(define (table-schema conn table-name)
- (map
- (match-lambda
- ((column_name data_type is_nullable)
- (list column_name
- data_type
- (string=? is_nullable "YES"))))
- (exec-query
- conn
- "
+ (let ((results
+ (exec-query
+ conn
+ "
SELECT column_name, data_type, is_nullable
FROM information_schema.columns
WHERE table_name = $1"
- (list table-name))))
+ (list table-name))))
+ (if (null? results)
+ (error
+ (simple-format #f "missing schema for ~A: ~A"
+ table-name
+ results))
+ (map
+ (match-lambda
+ ((column_name data_type is_nullable)
+ (list column_name
+ data_type
+ (string=? is_nullable "YES"))))
+ results))))
(define* (insert-missing-data-and-return-all-ids
conn
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Change table-schema to detect when there are no results,
Christopher Baines <=