-
Notifications
You must be signed in to change notification settings - Fork 13
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
LabeledEnum grouped values using lists instead of sets #149
Comments
Query: return db.session.query(JobPost).options(*JobPost._defercols).from_statement(db.text(
'''SELECT jobpost.id, jobpost.hashid, jobpost.datetime, jobpost.headline, jobpost.headlineb,
jobpost.location, jobpost.company_name, jobpost.type_id, jobpost.category_id, jobpost.status,
jobpost.pay_type, jobpost.pay_currency, jobpost.pay_cash_min, jobpost.pay_cash_max,
jobpost.pay_equity_min, jobpost.pay_equity_max, jobpost.email_domain
FROM (
SELECT jobpost_tag.jobpost_id AS jobpost_id, COUNT(*) AS count FROM jobpost_tag, jobpost
WHERE jobpost.id = jobpost_tag.jobpost_id AND tag_id IN (
SELECT tag_id FROM jobpost_tag WHERE jobpost_id=:id)
AND jobpost_id != :id AND jobpost.status IN :listed
AND jobpost.datetime >= NOW() AT TIME ZONE 'UTC' - INTERVAL '30 days'
AND jobpost_tag.status IN :tag_present
GROUP BY jobpost_tag.jobpost_id ORDER BY count DESC LIMIT :limit) AS matches, jobpost
WHERE jobpost.id = matches.jobpost_id;'''
)).params(id=self.id, listed=POSTSTATUS.LISTED, limit=limit, tag_present=tuple(TAG_TYPE.TAG_PRESENT)) SQLAlchemy error traceback:
Points of note:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
LabeledEnum introduced supported for grouped values using the set syntax in #148 (via b03b28a). The rationale was that sets are the appropriate data model for the
in
operator. However, it appears SQLAlchemy doesn't like sets for SQL IN operations and would prefer a list instead.LabeledEnum reserves tuples for its special syntax. Sets were introduced for groups, but lists are unused. Our options:
The text was updated successfully, but these errors were encountered: