lamindb_setup 1.2.0__py3-none-any.whl → 1.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lamindb_setup/__init__.py +1 -1
- lamindb_setup/core/django.py +25 -0
- {lamindb_setup-1.2.0.dist-info → lamindb_setup-1.3.0.dist-info}/METADATA +2 -2
- {lamindb_setup-1.2.0.dist-info → lamindb_setup-1.3.0.dist-info}/RECORD +6 -6
- {lamindb_setup-1.2.0.dist-info → lamindb_setup-1.3.0.dist-info}/LICENSE +0 -0
- {lamindb_setup-1.2.0.dist-info → lamindb_setup-1.3.0.dist-info}/WHEEL +0 -0
lamindb_setup/__init__.py
CHANGED
lamindb_setup/core/django.py
CHANGED
|
@@ -14,6 +14,31 @@ IS_MIGRATING = False
|
|
|
14
14
|
CONN_MAX_AGE = 299
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
def set_token(token: str | None, connection_name: str = "default"):
|
|
18
|
+
# None to reset
|
|
19
|
+
from django.db import connections
|
|
20
|
+
from django.db.backends.base.base import BaseDatabaseWrapper
|
|
21
|
+
|
|
22
|
+
connection = connections[connection_name]
|
|
23
|
+
assert connection.vendor == "postgresql"
|
|
24
|
+
|
|
25
|
+
if token is not None:
|
|
26
|
+
|
|
27
|
+
def connect(self):
|
|
28
|
+
BaseDatabaseWrapper.connect(self)
|
|
29
|
+
# now the connection should be set
|
|
30
|
+
# Use a psycopg cursor directly, bypassing Django's utilities.
|
|
31
|
+
with self.connection.cursor() as cursor:
|
|
32
|
+
cursor.execute("SELECT set_token(%s, false);", (token,))
|
|
33
|
+
else:
|
|
34
|
+
connect = BaseDatabaseWrapper.connect
|
|
35
|
+
|
|
36
|
+
connection.connect = connect.__get__(connection, connection.__class__)
|
|
37
|
+
# execute this to initially set or reset the token
|
|
38
|
+
connection.close()
|
|
39
|
+
connection.connect()
|
|
40
|
+
|
|
41
|
+
|
|
17
42
|
def close_if_health_check_failed(self) -> None:
|
|
18
43
|
if self.close_at is not None:
|
|
19
44
|
if time.monotonic() >= self.close_at:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: lamindb_setup
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: Setup & configure LaminDB.
|
|
5
5
|
Author-email: Lamin Labs <open-source@lamin.ai>
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -40,7 +40,7 @@ Provides-Extra: gcp
|
|
|
40
40
|
|
|
41
41
|
[](https://codecov.io/gh/laminlabs/lamindb-setup)
|
|
42
42
|
|
|
43
|
-
# lamindb-setup:
|
|
43
|
+
# lamindb-setup: Setting up `lamindb`
|
|
44
44
|
|
|
45
45
|
- User [docs](https://lamin.ai/docs)
|
|
46
46
|
- Developer [docs](https://lamindb-setup-htry.netlify.app/)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
lamindb_setup/__init__.py,sha256=
|
|
1
|
+
lamindb_setup/__init__.py,sha256=B7IVjz1M1qrpfYuPg4mQ66YiIyfAcYtmSfjLULXKpII,2692
|
|
2
2
|
lamindb_setup/_cache.py,sha256=aszT-zk3S5dTLKp5g1W-S_FPh2E5YVCALwWSGPJLWBM,1493
|
|
3
3
|
lamindb_setup/_check.py,sha256=28PcG8Kp6OpjSLSi1r2boL2Ryeh6xkaCL87HFbjs6GA,129
|
|
4
4
|
lamindb_setup/_check_setup.py,sha256=d1GS1Csy2G9AysfjoyVcNVY0lhHiWSwSLpfgdIQf35s,5477
|
|
@@ -36,12 +36,12 @@ lamindb_setup/core/_settings_store.py,sha256=WcsgOmgnu9gztcrhp-N4OONNZyxICHV8M0H
|
|
|
36
36
|
lamindb_setup/core/_settings_user.py,sha256=lWqV3HmZCsEq2UsU_iVNW0p9ddsNg7-B6xOaMNH1aw0,1475
|
|
37
37
|
lamindb_setup/core/_setup_bionty_sources.py,sha256=qTPMV5TEbNiTB81QqG2rSs6W8j8kQ7kVQMLOXRzAxBI,4004
|
|
38
38
|
lamindb_setup/core/cloud_sqlite_locker.py,sha256=i6TrT7HG0lqliPvZTlsZ_uplPaqhPBbabyfeR32SkA8,7107
|
|
39
|
-
lamindb_setup/core/django.py,sha256=
|
|
39
|
+
lamindb_setup/core/django.py,sha256=vmrGDiqX2FSmMII_YLcQtwO8SRzm6zKayjeNJLGhuiU,4697
|
|
40
40
|
lamindb_setup/core/exceptions.py,sha256=4NpLUNUIfXYVTFX2FvLZF8RW34exk2Vn2X3G4YhnTRg,276
|
|
41
41
|
lamindb_setup/core/hashing.py,sha256=M3Q1-ywnqh4Uy5zojbQfLju19HU0ySp8Oi7FGIJXfFI,3667
|
|
42
42
|
lamindb_setup/core/types.py,sha256=zJii2le38BJUmsNVvzDrbzGYr0yaeb-9Rw9IKmsBr3k,523
|
|
43
43
|
lamindb_setup/core/upath.py,sha256=AvRmICPBxQx-2iQYsXDFsrJS-AAUNuw6IymLcVmkWvo,33550
|
|
44
|
-
lamindb_setup-1.
|
|
45
|
-
lamindb_setup-1.
|
|
46
|
-
lamindb_setup-1.
|
|
47
|
-
lamindb_setup-1.
|
|
44
|
+
lamindb_setup-1.3.0.dist-info/LICENSE,sha256=UOZ1F5fFDe3XXvG4oNnkL1-Ecun7zpHzRxjp-XsMeAo,11324
|
|
45
|
+
lamindb_setup-1.3.0.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
|
|
46
|
+
lamindb_setup-1.3.0.dist-info/METADATA,sha256=jGAuIu11oaJ-YYGXR4iXnh99vurdfu1vaJuEPL756gc,1777
|
|
47
|
+
lamindb_setup-1.3.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|