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

It would be nice to have functional equivalents in SQLite #109

Closed
alper opened this issue Dec 15, 2020 · 4 comments
Closed

It would be nice to have functional equivalents in SQLite #109

alper opened this issue Dec 15, 2020 · 4 comments

Comments

@alper
Copy link

alper commented Dec 15, 2020

I see now that the package name and the project name are different here, but for local testing of netfields, it would be nice to have functional parity using other database engines particularly SQLite.

I see there are some unmaintained extensions there that maybe fill in some of the gaps but it seems like a bigger project in general to tackle this.

https://github.com/mobigroup/sqlite3-inet

@jimfunk
Copy link
Owner

jimfunk commented Dec 15, 2020

I took a look at that extension, but unfortunately it appears to be missing IPv6 support and a number of the query operators. It also appears to be unmaintained.

It would probably be cleaner to start a new project for that, but it would also require updates or a replacement for the SQLite extension. If such a thing existed AND was fully functional, then it could be a useful addition here, but I am not interested in taking on such an effort.

If the purpose of such a thing is for testing, it's not's hard to set up PostgreSQL and a user that can create test databases.

@jimfunk jimfunk closed this as completed Dec 15, 2020
@cbwest3-ntnx
Copy link

@jimfunk, I'm interested in SQLite parity as well. I would prefer to use netfields+Postgres for our project (we run Postgres in prod), but it's hard to ditch the speed of SQLite for local testing during development.

Would it be feasible to mirror the Postgres functionality for the SQLite backend using a naive column type and do Postgres function equivalents in Python, even if performance is subpar? It seems like a significant code change. Would the project be receptive to such a change? Thanks!

@cbwest3-ntnx
Copy link

Upon further review, it seems Django doesn't allow one to implement Functions and Lookups in Python to bridge a feature gap between databases, which I assume is due to the lazy execution of QuerySets. Django functions and lookups only craft custom SQL expressions to meet syntax expectations of whatever the database backend.

@jimfunk
Copy link
Owner

jimfunk commented Jan 16, 2021

Yes, the functionality here is a lot more than simply storing addresses and converting data upon retrieval. It's about making queries such as "address is in a range." Those kinds of things would require database support. Supposedly that can be done, but it would be module on the SQLite side.

For testing, I simply use a local PostgreSQL instance with a user that can create databases. It's very fast and you don't have to worry about missing any sort of error that would only happen in production.

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

No branches or pull requests

3 participants