lambda-packages icon indicating copy to clipboard operation
lambda-packages copied to clipboard

Upgrade to SQLite 3.30; Django 2.2 requires at least SQLite 3.8.3.

Open FlipperPA opened this issue 6 years ago • 7 comments

UPDATE: this is unlikely to ever be merged in. Please use the more modern version here: https://github.com/FlipperPA/django-s3-sqlite

This upgrades to the latest/greatest version.

Django 2.2 deploys using SQLite (or the Zappa Django Utils s3sqlite engine) will fail, because the current package is SQLite 3.6.0.

Cheers!

FlipperPA avatar Jul 27 '19 17:07 FlipperPA

@FlipperPA did you ever get this working? I for the life of me can't.

youcandanch avatar Aug 22 '19 03:08 youcandanch

@youcandanch I'm going to give it another whirl next week. I had it working locally, and wanted to test it as part of Lambda packages, but now it doesn't appear to be working from local. I'm wondering if I missed something, or something was cached.

I'll look into it more deeply next week.

FlipperPA avatar Aug 24 '19 02:08 FlipperPA

I finally got some time to look at this. It turns out we need to build a full build_static version of SQLite3 with Python, rather than linking to the system version, which would still be 3.7.17 on AWS. I followed the instructions here:

https://charlesleifer.com/blog/compiling-sqlite-for-use-with-python-applications/

This created a much, much larger binary (which makes sense), because it should contain all of SQLite. I've successfully pushed out the binary and have it responding from AWS Lambda with version 3.30:

(pyphilly_venv) [tallen@wrds-pub1-dev-h pyphilly]$ zappa invoke --raw dev "import sqlite3; print(sqlite3.sqlite_version)"
Calling invoke for stage dev..
[START] RequestId: 14afc48d-076e-45dd-8218-7b184b876079 Version: $LATEST
[DEBUG] 2019-11-16T22:44:08.936Z 14afc48d-076e-45dd-8218-7b184b876079 Zappa Event: {'raw_command': 'import sqlite3; print(dir(sqlite3)); print(sqlite3.sqlite_version)'}
3.30.1
[END] RequestId: 14afc48d-076e-45dd-8218-7b184b876079
[REPORT] RequestId: 14afc48d-076e-45dd-8218-7b184b876079
Duration: 2.97 ms
Billed Duration: 100 ms
Memory Size: 512 MB
Max Memory Used: 81 MB

Anyone else care to test? @youcandanch?

FlipperPA avatar Nov 16 '19 22:11 FlipperPA

@Miserlou @mcrowson @jneves This is now ready to be merged. I've got it running in dev and production on my site at https://pyphilly.org/ with the latest Django and Wagtail versions. Huzzah!

FlipperPA avatar Nov 17 '19 22:11 FlipperPA

If anyone is waiting for this, in the meantime, feel free to use this: https://github.com/FlipperPA/django-s3-sqlite

FlipperPA avatar Nov 17 '19 22:11 FlipperPA

Is there any progress in merging this?

vaivars avatar Jul 06 '20 12:07 vaivars

@vaivars It is unlikely this will every be merged in. You can use https://github.com/FlipperPA/django-s3-sqlite which is now more advanced, with quite a few more checks to help avoid (but not eliminate) race conditions.

FlipperPA avatar Jul 06 '20 19:07 FlipperPA

I’m not sure how to test this, but I see tests added.

npm test -- prettier from the root!

natemoo-re avatar Apr 16 '21 18:04 natemoo-re

Did you mean to remove the social banner in this branch?

drwpow avatar Apr 16 '21 20:04 drwpow

Did you mean to remove the social banner in this branch?

No, those commits were on main but got overwritten. Rebase seems to have fixed it appearing on this branch.

natemoo-re avatar Apr 17 '21 19:04 natemoo-re

I was playing around with this locally, and there seem to be some edge cases with interpolations where running Prettier breaks the syntax.

Oh no! Good catch. I'm really hoping we don's have to implement much custom printing logic, but it may be the only way around stuff like this.

I'll have to check how the official JSX formatting handles expressions!

natemoo-re avatar Apr 17 '21 19:04 natemoo-re