File tree 3 files changed +21
-12
lines changed
3 files changed +21
-12
lines changed Original file line number Diff line number Diff line change 36
36
- name : Run unit tests
37
37
run : tox run -- --cov-report=term
38
38
39
+ test-db :
40
+ runs-on : ubuntu-latest
41
+ steps :
42
+ - uses : actions/checkout@v3
43
+ - name : Install Lets
44
+ uses : lets-cli/lets-action@v1.1
45
+ with :
46
+ version : latest
47
+ - name : Test database integration
48
+ run : timeout 600 lets test-pg
49
+
39
50
federation-test :
40
51
runs-on : ubuntu-latest
41
52
steps :
Original file line number Diff line number Diff line change @@ -37,16 +37,14 @@ def in_impl(
37
37
def select_expr (
38
38
self , fields_ : List [Field ], ids : Iterable
39
39
) -> Tuple [Select , Callable ]:
40
- visited = set ()
41
- columns = []
42
- query_columns = []
43
- for f in fields_ :
44
- column = self .from_clause .c [f .name ]
45
- columns .append (column )
46
-
47
- if f .name not in visited and column != self .primary_key :
48
- visited .add (f .name )
49
- query_columns .append (column )
40
+ result_columns = [self .from_clause .c [f .name ] for f in fields_ ]
41
+ # aiopg requires unique columns to be passed to select,
42
+ # otherwise it will raise an error
43
+ query_columns = [
44
+ column
45
+ for f in _uniq_fields (fields_ )
46
+ if (column := self .from_clause .c [f .name ]) != self .primary_key
47
+ ]
50
48
51
49
expr = (
52
50
sqlalchemy .select (
@@ -58,7 +56,7 @@ def select_expr(
58
56
59
57
def result_proc (rows : List [_sa .Row ]) -> List :
60
58
rows_map = {
61
- row [self .primary_key ]: [row [c ] for c in columns ]
59
+ row [self .primary_key ]: [row [c ] for c in result_columns ]
62
60
for row in map (_sa ._process_result_row , rows )
63
61
}
64
62
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ commands:
57
57
test-pg :
58
58
description : Run tests with pg
59
59
depends : [_build-tests]
60
- cmd : [docker- compose, run, --rm, test-pg]
60
+ cmd : [docker compose, run, --rm, test-pg]
61
61
62
62
test-tox :
63
63
description : Run tests using tox
You can’t perform that action at this time.
0 commit comments