Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-14771: Add support for views to Schema #52

Merged
merged 4 commits into from Jun 18, 2018
Merged

Conversation

pschella
Copy link
Collaborator

No description provided.

@TallJimbo
Copy link
Member

@pschella, note that I also already started on the dataUnit.py parts of this on DM-14428. Looks like we went in almost the same direction, and you got farther than I did, so there's certainly no need to roll any of that back. But once you've got the rest of this working I'd be happy to take over that part - I know you're due to disappear at virtually any moment.


if isinstance(selectable, str):
selectable = select([text(selectable.lstrip("SELECT"))])

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if you can do something simple like

t = alias(selectable, name=name)

instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I was thinking about something different here. Ignore my comment if it confuses you 😕

@@ -77,7 +77,7 @@ def __init__(self, registryConfig, schemaConfig):
self.config = SqlRegistryConfig(registryConfig)
self.storageClasses = StorageClassFactory()
self._schema = Schema(schemaConfig)
self._engine = create_engine(self.config['db'])
self._engine = create_engine(self.config['db'], echo=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is for debugging, it should not go into master?

"""When not ``None`` the primary table entry corresponding to this
`DataUnitJoin` (`sqlalchemy.core.TableClause`, optional).
"""
return getattr(self, '_table', None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just self._table?

Copy link
Member

@TallJimbo TallJimbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! A few minor comments.

# - ExposureRange
# sql:
# (lhs.camera = rhs.camera) AND
# (lhs.exposure BETWEEN rhs.valid_first AND rhs.valid_last)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of commenting this out, let's just leave this as it was, and ignore it when building the schema for now. I don't think we will ever want to make it a view; I think we'll instead want to find some way to inject this join expression into preflight queries.

I think since this "sql" entry is not inside a "tables" entry, this shouldn't be parsed by the DataUnitJoin code; if it is, we should fix that instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is skipped.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just commented it out such that the skipping is more explicit.

rhs : `tuple`
Right-hand-side of the join.
summarizes : `DataUnit`
Summarizes this other `DataUnit`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a DataUnitJoin, not a DataUnit, right?

rhs=rhs,
summarizes=summarizes,
table=table)
self.joins[dataUnitJoinName] = dataUnitJoin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this needs to be changed here, but as an FYI, on DM-14428 I'll probably switch the keys to be (lhs, rhs), as I think that's what we'll want to use for lookup most of the time. Please shout if you think that'll be problematic.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that is fine.

@pschella pschella merged commit 4623940 into master Jun 18, 2018
@ktlim ktlim deleted the tickets/DM-14771 branch August 25, 2018 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants