Skip to content

Copy or clone row #477

Closed
Closed
@josejachuf

Description

Please add a new feature to the ORM that allows you to create a record from an existing one. See [1]

I had thought about something similar to how you can create a structure from another in Rust

class MyModel(Model):
    a = Field()
    a = Field()
    c= Field.int()

foo = MyModel.get(id=1)

bar = MyModel.copy(foo) # Copy a, b and c

bar_2 = MyModel.copy(a='emmett', foo) # Copy b and c, but not a
bar_2 = MyModel.copy(foo, a='emmett') # Copy b and c, but not a

Thanks

[1] #393

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions