Closed lycantropos closed 4 years ago
How is this going? If you have a proposal on how to parse and convert constraints, I might be able to look at ways to process CheckConstraints if you'd like
@rubenhelsloot: I'm not so familiar with them, there is sqlparse
package that may help in parsing constraints' expression, but there is a problem of generating such constraints as a strategy and serializing tokens back to str
, is it really needed (because it looks complicated from my point of view)?
One way of filtering records based on presence of CheckConstraint
in Table
is following:
ast.Lambda
node which accepts table record (parameters names should agree with columns names) and evaluates converted expression.lambda
function in filter
on records strategy.It is not necessarily needed, I fix it now by adding my own set of filter conditions, but that requires intimate knowledge of the database constraints and I think it would be a nice step towards feature completeness. On the other hand, if you're aiming for a more barebones package that is easy to understand and potentially mock, then I can see how this will add unnecessary complication
We can start with UniqueConstraint
since it looks easier to implement, after that we can move forward to CheckConstraint
I guess, it is not impossible, but requires time, I want to have library as complete and easy to use as possible.
All right, is there something I can do to help?
@rubenhelsloot: you can open a PR with implementation draft and after some review-update iterations we can make it work or wait one-two days before I'll end with my current task on another project.
I was naive at a time thinking that Delaunay triangulation can be implemented in a week, it took me 2 months, so now I'm going to move on constraints right after #22.
We have currently support for single unique columns and we should add support for unique constraints too (both their generating & handling in records creation).