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

CockroachDB support #507

Closed
sergeyshaykhullin opened this issue Feb 7, 2022 · 19 comments
Closed

CockroachDB support #507

sergeyshaykhullin opened this issue Feb 7, 2022 · 19 comments
Assignees

Comments

@sergeyshaykhullin
Copy link

sergeyshaykhullin commented Feb 7, 2022

Sqlx has a known issue with transations and MARS
launchbadge/sqlx#933

Does sea orm has a workaround to do multiple inserts inside single transaction with CockroachDB?

tokio-postgres has no problems, so it might be fixed on client side somehow without waiting for cockroachdb/cockroach#40195

@billy1624
Copy link
Member

billy1624 commented Feb 13, 2022

Hey @sergeyshaykhullin, a workaround suggested on launchbadge/sqlx#933 (comment). This imply you can use .all() to avoid the error.

For example,

let chocolate: Vec<cake::Model> = Cake::find()
    .filter(cake::Column::Name.contains("chocolate"))
    .order_by_asc(cake::Column::Name)
    .all(db)  // Select `all` instead of `one`
    .await?;

https://www.sea-ql.org/SeaORM/docs/basic-crud/select#find-with-conditions-and-orders

@sergeyshaykhullin
Copy link
Author

I need an insert

@billy1624
Copy link
Member

I need an insert

Oh, right.

@billy1624
Copy link
Member

Btw... can I take a look at the error messages?

@sergeyshaykhullin
Copy link
Author

sergeyshaykhullin commented Feb 13, 2022

Yes

  1. You need a running cockroachdb
version: "2"

services:
  crdb:
    container_name: crdb
    image: cockroachdb/cockroach:latest
    command: [ start-single-node, --insecure ]
    ports: [ 8080:8080, 26257:26257 ]
    volumes: [ crdb_data:/cockroach/cockroach-data ]

volumes:
  crdb_data:
    driver: local
  1. Connection string
postgresql://root@127.0.0.1:26257/defaultdb?sslmode=disable
  1. And something with the insert

async fn create_post(

To reproduce you will need to wrap create_post with transaction

I moved all prototypes in trash folder a week ago, so i can't show something. But the error was same as here launchbadge/sqlx#933 unimplemented: multiple active portals not supported

@billy1624
Copy link
Member

Thanks!! I will try reproduce it tmr morning. Gonna sleep now lol

@billy1624
Copy link
Member

Hey @sergeyshaykhullin, I manage to insert rows into ChroachDB without hitting any errors. Check #531

@sergeyshaykhullin
Copy link
Author

I can't see begin transaction here 😅

@billy1624
Copy link
Member

Ok, now we have transaction, 340e3a0. Works as well loll

@sergeyshaykhullin
Copy link
Author

@billy1624 Hmm, interesting... You need multiple inserts to catch this error...

image

@sergeyshaykhullin
Copy link
Author

Also i found another one)
image

@billy1624
Copy link
Member

Oh. Okay, hidden bug...

@billy1624 billy1624 added this to the 0.7.x milestone Mar 1, 2022
@AbhijithGanesh
Copy link

What all tasks need to be implemented for supporting Cockroach DB? It'd really be useful for new-contributors to learn

@billy1624
Copy link
Member

What all tasks need to be implemented for supporting Cockroach DB? It'd really be useful for new-contributors to learn

Hey @AbhijithGanesh, do you mean what are the todo for supporting CockroachDB?

@tyt2y3 tyt2y3 removed this from the 0.7.x milestone Mar 15, 2022
@mckingho
Copy link

unimplemented: multiple active portals not supported issue will likely be fixed in CockroachDB v22.2 according to launchbadge/sqlx#933 (comment)

@billy1624
Copy link
Member

Thanks! @mckingho for the updates!

@tyt2y3
Copy link
Member

tyt2y3 commented Nov 6, 2022

I don't think we have the engineering resources (in terms of CI and manpower) to support CockroachDB at this point.
If there is enough interest let's do a crowdfunding may be.
It's something I think definitely a good addition to the SeaQL ecosystem.

@tyt2y3 tyt2y3 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 6, 2022
@m-yosefpor
Copy link

I've noticed that the issue in CockroachDB (#40195) has been fixed. Given this update, is there any change in the priority of supporting CockroachDB with SeaORM? We are particularly interested in this feature and would appreciate any information on planned developments or necessary steps to move forward. Thank you for your consideration.

@NewtTheWolf
Copy link

Hello, also here to ask what would be exactly needed to Support CockroachDB? is it possible to Discuss what exactly would be needed?

So i just run into an Error while running a Migration with SeaORM v1

Execution Error: error returned from database: at or near "]": syntax error: unimplemented: this syntax thats not an Error of the Migration directly more what comes "after" the Mig, that SeaORM tries to write the Migrated files into its own Table (i think so)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

7 participants