Skip to content

DM-53212: Add functions for getting full ccdVisit table and wide quicklook table#185

Open
mfisherlevine wants to merge 2 commits intomainfrom
tickets/DM-53212
Open

DM-53212: Add functions for getting full ccdVisit table and wide quicklook table#185
mfisherlevine wants to merge 2 commits intomainfrom
tickets/DM-53212

Conversation

@mfisherlevine
Copy link
Copy Markdown
Contributor

No description provided.

join_type="inner",
table_names=("vq", "v"),
uniq_col_name="{col_name}_{table_name}", # only duplicates get suffixed
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm a little surprised you're doing this join with astropy instead of SQL.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I really think it makes more sense to do this join with SQL.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Looks like I can replace this with

vqCols = set(client.query("SELECT * FROM cdb_LSSTCam.visit1_quicklook LIMIT 0").colnames)
vCols = set(client.query("SELECT * FROM cdb_LSSTCam.visit1 LIMIT 0").colnames)

vOnlyCols = vCols - vqCols  # exclude visit_id and all duplicates

selectClauses = ["vq.*"] + [f"v.{col}" for col in sorted(vOnlyCols)]

query = f"""
    SELECT {', '.join(selectClauses)}
    FROM cdb_LSSTCam.visit1_quicklook vq
    INNER JOIN cdb_LSSTCam.visit1 v USING (visit_id)
    WHERE vq.day_obs = {dayObs}
"""
return client.query(query)

Does that look reasonable to you, or am I still missing tricks?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

And was it just this function, or did you think the other one should have more things moved to SQL too?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That looks good to me, and think it was only this function.

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.

3 participants