Git Product home page Git Product logo

Comments (10)

tyt2y3 avatar tyt2y3 commented on May 18, 2024 1

Oh okay I got it now, Billy added it for testing the driver support.

from sea-orm.

samsamai avatar samsamai commented on May 18, 2024

Hi @tyt2y3 , I'm not clear about what the task sequential operations means.

from sea-orm.

tyt2y3 avatar tyt2y3 commented on May 18, 2024

So the idea is to have several test cases with several transactions, for example (me just thinking randomly):

  1. select the baker having the least sales
  2. create and assign more cakes to him
  3. create new order based on the the new baker's cakes
  4. select and verify the result

that is what I mean by 'read, insert / update, read again and update again'

from sea-orm.

samsamai avatar samsamai commented on May 18, 2024

Hi @tyt2y3 , thanks for the clarification, I've started to implement this but I have run into the same problem that I was asking about in the discussion area. How can I do a query such as this with the ORM:

SELECT
	baker.name, sum(lineitem.price * lineitem.quantity)

FROM
	baker
	INNER JOIN cakes_bakers ON cakes_bakers.baker_id = baker.id
	INNER JOIN cake ON cakes_bakers.cake_id = cake.id
	INNER JOIN lineitem ON lineitem.cake_id = cake.id
GROUP BY
	baker.name;

I don't seem to be able to do multiple joins in one query (for example baker::Entity::find().left_join(cake::Entity) .left_join(lineitem::Entity)) and I haven't been able to find a similar case in the codebase so I'm a bit stuck.

from sea-orm.

tyt2y3 avatar tyt2y3 commented on May 18, 2024

There is another method in query/helper.rs

    fn join(mut self, join: JoinType, rel: RelationDef) -> Self {
        self.query()
            .join(join, rel.to_tbl.clone(), join_condition(rel));
        self
    }

That does not require a Related trait

from sea-orm.

samsamai avatar samsamai commented on May 18, 2024

Thanks, got it working now.

from sea-orm.

tyt2y3 avatar tyt2y3 commented on May 18, 2024

We'd want to refactor our test suite and test for Postgres & SQLite

  1. generalize setup() function to obtain database url from env
  2. extract & generalize any MySQL specific code
  3. make the test suite passes on Postgres
  4. (if no database url passed in from env, fallback to an in memory SQLite database)
    make the test suite passes on SQLite

from sea-orm.

tyt2y3 avatar tyt2y3 commented on May 18, 2024

@samsamai can you explain what the file pg_tests is for?
Is it duplicate of bakery_chain_tests?

from sea-orm.

samsamai avatar samsamai commented on May 18, 2024

@tyt2y3 pg_tests was done by @billy1624 for when he was working on the pg_driver I think.

from sea-orm.

tyt2y3 avatar tyt2y3 commented on May 18, 2024

Thank you so much for the great work indeed!

from sea-orm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.