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

Foreign Key #78

Open
soraxas opened this issue Nov 29, 2023 · 2 comments
Open

Foreign Key #78

soraxas opened this issue Nov 29, 2023 · 2 comments

Comments

@soraxas
Copy link

soraxas commented Nov 29, 2023

Thanks for this repo!

Does SimpleSQLite supports foreign key (with ORM) by referencing another table?

For example:

class EmailAddress(Model):
    id = Integer(primary_key=True)
    address = Text(not_null=True, unique=True)

class Email(Model):
    id = Integer(primary_key=True)
    content= Text()
    from_addr = Email()  # This?
    to_addr = Email()  # And this?

Moreover, if so, can we create the corresponding foreignkey entry if it doesn't already exists?

Email.insert(
  Email(
    content="Hello!", 
    from_addr=EmailAddress(...), 
    to_addr=EmailAddress(...),
  )
)
@thombashi
Copy link
Owner

@soraxas
Unfortunately, SimpleSQLite does not support foreign keys for ORM for now.
I will consider future enhancements.

@soraxas
Copy link
Author

soraxas commented Dec 4, 2023

I see! Anything that I can help with it?

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

No branches or pull requests

2 participants