Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5
Commits
1939813e
Commit
1939813e
authored
Jun 08, 2017
by
Vincent Pelletier
Committed by
Eteri
Oct 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZSQLCatalog: Add inner_join_list support.
parent
32a30fb1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
product/ZSQLCatalog/ColumnMap.py
product/ZSQLCatalog/ColumnMap.py
+6
-1
product/ZSQLCatalog/Query/EntireQuery.py
product/ZSQLCatalog/Query/EntireQuery.py
+3
-0
product/ZSQLCatalog/SQLCatalog.py
product/ZSQLCatalog/SQLCatalog.py
+2
-0
No files found.
product/ZSQLCatalog/ColumnMap.py
View file @
1939813e
...
@@ -59,6 +59,7 @@ class ColumnMap(object):
...
@@ -59,6 +59,7 @@ class ColumnMap(object):
catalog_table_name
=
None
,
catalog_table_name
=
None
,
table_override_map
=
None
,
table_override_map
=
None
,
left_join_list
=
None
,
left_join_list
=
None
,
inner_join_list
=
None
,
implicit_join
=
False
):
implicit_join
=
False
):
self
.
catalog_table_name
=
catalog_table_name
self
.
catalog_table_name
=
catalog_table_name
# Key: group
# Key: group
...
@@ -107,6 +108,10 @@ class ColumnMap(object):
...
@@ -107,6 +108,10 @@ class ColumnMap(object):
assert
not
(
self
.
implicit_join
and
self
.
left_join_list
),
(
assert
not
(
self
.
implicit_join
and
self
.
left_join_list
),
(
"Cannot do left_joins while forcing implicit join"
"Cannot do left_joins while forcing implicit join"
)
)
self
.
inner_join_list
=
inner_join_list
assert
not
set
(
left_join_list
).
intersection
(
inner_join_list
),
(
"left_join_list and inner_join_list intersect"
)
def
registerColumn
(
self
,
raw_column
,
group
=
DEFAULT_GROUP_ID
,
simple_query
=
None
):
def
registerColumn
(
self
,
raw_column
,
group
=
DEFAULT_GROUP_ID
,
simple_query
=
None
):
assert
' as '
not
in
raw_column
.
lower
(),
raw_column
assert
' as '
not
in
raw_column
.
lower
(),
raw_column
...
@@ -666,7 +671,7 @@ class ColumnMap(object):
...
@@ -666,7 +671,7 @@ class ColumnMap(object):
# table aliases should cause some of these table definitions to be
# table aliases should cause some of these table definitions to be
# collapsed into others.
# collapsed into others.
assert
self
.
_setMinimalTableDefinition
()
assert
self
.
_setMinimalTableDefinition
()
Join
=
(
column
in
self
.
left_join_list
or
Join
=
column
not
in
self
.
inner_join_list
and
(
column
in
self
.
left_join_list
or
(
not
self
.
implicit_join
and
column
in
self
.
registry
.
get
(
DEFAULT_GROUP_ID
,
())))
\
(
not
self
.
implicit_join
and
column
in
self
.
registry
.
get
(
DEFAULT_GROUP_ID
,
())))
\
and
LeftJoin
or
InnerJoin
and
LeftJoin
or
InnerJoin
join_definition
=
Join
(
self
.
table_definition
,
right_side
,
join_definition
=
Join
(
self
.
table_definition
,
right_side
,
...
...
product/ZSQLCatalog/Query/EntireQuery.py
View file @
1939813e
...
@@ -59,6 +59,7 @@ class EntireQuery(object):
...
@@ -59,6 +59,7 @@ class EntireQuery(object):
group_by_list
=
(),
group_by_list
=
(),
select_dict
=
None
,
select_dict
=
None
,
left_join_list
=
(),
left_join_list
=
(),
inner_join_list
=
(),
limit
=
None
,
limit
=
None
,
catalog_table_name
=
None
,
catalog_table_name
=
None
,
extra_column_list
=
(),
extra_column_list
=
(),
...
@@ -71,6 +72,7 @@ class EntireQuery(object):
...
@@ -71,6 +72,7 @@ class EntireQuery(object):
self
.
group_by_list
=
list
(
group_by_list
)
self
.
group_by_list
=
list
(
group_by_list
)
self
.
select_dict
=
defaultDict
(
select_dict
)
self
.
select_dict
=
defaultDict
(
select_dict
)
self
.
left_join_list
=
left_join_list
self
.
left_join_list
=
left_join_list
self
.
inner_join_list
=
inner_join_list
self
.
limit
=
limit
self
.
limit
=
limit
self
.
catalog_table_name
=
catalog_table_name
self
.
catalog_table_name
=
catalog_table_name
self
.
extra_column_list
=
list
(
extra_column_list
)
self
.
extra_column_list
=
list
(
extra_column_list
)
...
@@ -89,6 +91,7 @@ class EntireQuery(object):
...
@@ -89,6 +91,7 @@ class EntireQuery(object):
column_map
=
ColumnMap
(
catalog_table_name
=
self
.
catalog_table_name
,
column_map
=
ColumnMap
(
catalog_table_name
=
self
.
catalog_table_name
,
table_override_map
=
self
.
from_expression
,
table_override_map
=
self
.
from_expression
,
left_join_list
=
self
.
left_join_list
,
left_join_list
=
self
.
left_join_list
,
inner_join_list
=
self
.
inner_join_list
,
implicit_join
=
self
.
implicit_join
,
implicit_join
=
self
.
implicit_join
,
)
)
self
.
column_map
=
column_map
self
.
column_map
=
column_map
...
...
product/ZSQLCatalog/SQLCatalog.py
View file @
1939813e
...
@@ -2366,6 +2366,7 @@ class Catalog(Folder,
...
@@ -2366,6 +2366,7 @@ class Catalog(Folder,
select_dict
=
kw
.
pop
(
'select_dict'
,
{})
select_dict
=
kw
.
pop
(
'select_dict'
,
{})
# Handle left_join_list
# Handle left_join_list
left_join_list
=
kw
.
pop
(
'left_join_list'
,
())
left_join_list
=
kw
.
pop
(
'left_join_list'
,
())
inner_join_list
=
kw
.
pop
(
'inner_join_list'
,
())
# Handle implicit_join. It's True by default, as there's a lot of code
# Handle implicit_join. It's True by default, as there's a lot of code
# in BT5s and elsewhere that calls buildSQLQuery() expecting implicit
# in BT5s and elsewhere that calls buildSQLQuery() expecting implicit
# join. self._queryResults() defaults it to False for those using
# join. self._queryResults() defaults it to False for those using
...
@@ -2393,6 +2394,7 @@ class Catalog(Folder,
...
@@ -2393,6 +2394,7 @@ class Catalog(Folder,
group_by_list
=
group_by_list
,
group_by_list
=
group_by_list
,
select_dict
=
select_dict
,
select_dict
=
select_dict
,
left_join_list
=
left_join_list
,
left_join_list
=
left_join_list
,
inner_join_list
=
inner_join_list
,
implicit_join
=
implicit_join
,
implicit_join
=
implicit_join
,
limit
=
limit
,
limit
=
limit
,
catalog_table_name
=
query_table
,
catalog_table_name
=
query_table
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment