Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 948827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:18:26+00:00 2026-05-15T23:18:26+00:00

My schema looks something like this: CREATE TABLE plans ( id SERIAL PRIMARY KEY,

  • 0

My schema looks something like this:

CREATE TABLE plans (
    id SERIAL PRIMARY KEY,
    description text
);

CREATE TABLE projects (
    id SERIAL PRIMARY KEY,
    project_id character varying(240) UNIQUE,
    plan_id integer REFERENCES plans(id) ON DELETE CASCADE
);

And I want to do Storm queries along the lines of

plan = store.find(Plan, Plan.project_id == "alpha")
# should translate to something like
# SELECT p.* from plans p LEFT JOIN projects proj ON p.id = proj.plan_id
#     WHERE proj.project_id = 'alpha';

(Note that projects.plan_id is not unique.)

How do I set this up?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T23:18:27+00:00Added an answer on May 15, 2026 at 11:18 pm

    For the given SQL, there isn’t much reason to use a left join, since your where clause won’t match any rows where there isn’t a corresponding project. You could get the results with:

    result = store.find(Plan, Plan.id == Project.plan_id, Project.project_id == "alpha")
    

    This will give you a ResultSet object. Given your schema, it looks like you’re expecting a single row, so you can access that with:

    plan = result.one()
    

    Or tie them both together with:

    plan = store.find(Plan, Plan.id == Project.plan_id, Project.project_id == "alpha").one()
    

    If you really need to do a left join, the syntax for that would be something like this:

    result = store.using(LeftJoin(Plan, Project, Plan.id == Project.plan_id)).find(
        Plan, Project.project_id == "alpha")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create an XML schema that looks something like this: <xs:element name=wrapperElement>
I have a table in PostgreSQL where the schema looks like this: CREATE TABLE
Ever wonder what wikipedia's database schema looks like? I recently read this thread from
I have a an XSD that looks like this (roughly) <xs:schema id=Appointment targetNamespace=http://tempuri.org/Record.xsd elementFormDefault=qualified
Its a .vbproj and looks like this <Project DefaultTargets=Build xmlns=http://schemas.microsoft.com/developer/msbuild/2003> <PropertyGroup> <ProjectGuid>15a7ee82-9020-4fda-a7fb-85a61664692d</ProjectGuid> all i
I have a flat-file schema that has a header and detail records. It looks
Which Database table Schema is more efficient and why? Users (UserID, UserName, CompamyId) Companies
I have some Oracle tables that represent a parent-child relationship. They look something like
I wrote the database schema (only one table so far), and the INSERT statements
I try to define a schema for XML documents I receive. The documents look

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.