lamindb_setup 0.81.3__py3-none-any.whl → 0.81.5__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 CHANGED
@@ -33,7 +33,7 @@ Modules & settings:
33
33
 
34
34
  """
35
35
 
36
- __version__ = "0.81.3" # denote a release candidate for 0.1.0 with 0.1rc1
36
+ __version__ = "0.81.5" # denote a release candidate for 0.1.0 with 0.1rc1
37
37
 
38
38
  import os as _os
39
39
  import sys as _sys
@@ -52,6 +52,49 @@ def _get_current_instance_settings() -> InstanceSettings | None:
52
52
  return None
53
53
 
54
54
 
55
+ def check_connecting_to_v1_instance(isettings: InstanceSettings):
56
+ from urllib.parse import urlparse
57
+
58
+ # we need to do this because the sqlite file should be already synced
59
+ # has no effect if not cloud sqlite
60
+ # errors if the sqlite file is not in the cloud and doesn't exist locally
61
+ # isettings.db syncs but doesn't error in this case due to error_no_origin=False
62
+ isettings._update_local_sqlite_file()
63
+
64
+ parsed_uri = urlparse(isettings.db)
65
+ db_type = parsed_uri.scheme
66
+
67
+ if db_type == "sqlite":
68
+ import sqlite3
69
+
70
+ conn = sqlite3.connect(parsed_uri.path)
71
+ elif db_type in ["postgresql", "postgres"]:
72
+ import psycopg2
73
+
74
+ conn = psycopg2.connect(isettings.db)
75
+ else:
76
+ raise ValueError("Unsupported database type. Use 'sqlite' or 'postgresql' URI.")
77
+
78
+ cur = conn.cursor()
79
+
80
+ if db_type == "sqlite":
81
+ cur.execute(
82
+ "SELECT name FROM sqlite_master WHERE type='table' AND name='lamindb_user'"
83
+ )
84
+ isv1 = cur.fetchone() is not None
85
+
86
+ else: # postgres
87
+ cur.execute(
88
+ "SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_name = 'lamindb_user')"
89
+ )
90
+ isv1 = cur.fetchone()[0]
91
+
92
+ if isv1:
93
+ raise SystemExit(
94
+ "This instance runs lamindb v1. Please run: pip install 'lamindb[bionty,wetlab,clinicore,ourprojects]'>1.0.0"
95
+ )
96
+
97
+
55
98
  # we make this a private function because in all the places it's used,
56
99
  # users should not see it
57
100
  def _check_instance_setup(
@@ -77,6 +120,7 @@ def _check_instance_setup(
77
120
  if isettings is not None:
78
121
  if reload_module and settings.auto_connect:
79
122
  if not django.IS_SETUP:
123
+ check_connecting_to_v1_instance(isettings)
80
124
  django.setup_django(isettings)
81
125
  if from_module is not None:
82
126
  # this only reloads `from_module`
lamindb_setup/_migrate.py CHANGED
@@ -28,14 +28,11 @@ def check_whether_migrations_in_sync(db_version_str: str):
28
28
  or installed_version.minor < db_version.minor
29
29
  ):
30
30
  db_version_lower = f"{db_version.major}.{db_version.minor}"
31
- db_version_upper = f"{db_version.major}.{db_version.minor + 1}"
32
- logger.warning(
33
- f"the database ({db_version_str}) is ahead of your installed lamindb"
34
- f" package ({installed_version_str})"
35
- )
36
- logger.important(
37
- "please update lamindb: pip install"
38
- f' "lamindb>={db_version_lower},<{db_version_upper}"'
31
+ raise SystemExit(
32
+ f"The database ({db_version_str}) is ahead of your installed lamindb"
33
+ f" package ({installed_version_str})\n"
34
+ "Please update lamindb: pip install"
35
+ f" 'lamindb[bionty,wetlab,clinicore,ourprojects]'>={db_version_lower}"
39
36
  )
40
37
  elif (
41
38
  installed_version.major > db_version.major
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: lamindb_setup
3
- Version: 0.81.3
3
+ Version: 0.81.5
4
4
  Summary: Setup & configure LaminDB.
5
5
  Author-email: Lamin Labs <open-source@lamin.ai>
6
6
  Requires-Python: >=3.9
@@ -1,7 +1,7 @@
1
- lamindb_setup/__init__.py,sha256=xPpghv8_6NLAzTOyEbqSg4UsrBIVXl-wFpemsz9p40o,1714
1
+ lamindb_setup/__init__.py,sha256=E0_mpQpJ8zIsVpG7ImGaeoYgsG_BaMJkkYKa7O7KCRw,1714
2
2
  lamindb_setup/_cache.py,sha256=1XnM-V_KprbjpgPY7Bg3FYn53Iz_2_fEgcMOaSdKKbg,1332
3
3
  lamindb_setup/_check.py,sha256=28PcG8Kp6OpjSLSi1r2boL2Ryeh6xkaCL87HFbjs6GA,129
4
- lamindb_setup/_check_setup.py,sha256=6cSfpmVOSgU7YiVHfJpBTGTQ7rrnwunt1pJT_jkgNM8,3196
4
+ lamindb_setup/_check_setup.py,sha256=XO2nBRsCu24n0f3ugjw29nd8-_nfy6ubfJfjabV6Ees,4649
5
5
  lamindb_setup/_close.py,sha256=cXNwK7QTTyNFt2XTpLnO3KHljJ7ShOcISk95np_dltE,1239
6
6
  lamindb_setup/_connect_instance.py,sha256=ClSM1zQAqVmNBapmB7H3dzmnWdn1dkpr_y5HAsF74XU,16070
7
7
  lamindb_setup/_delete.py,sha256=yjLIegM2Lh6sWRSTTybI17wK_kA4_pF_k3iVUkkgEAE,5681
@@ -10,7 +10,7 @@ lamindb_setup/_entry_points.py,sha256=Hs2oJQOCTaGUdWn-1mufM6qUZr9W_EJ_Oc3f0_Vc0Y
10
10
  lamindb_setup/_exportdb.py,sha256=43g77-tH-vAlTn8ig1mMD9-KXLKvxUeDLaq0gVu3l-c,2114
11
11
  lamindb_setup/_importdb.py,sha256=yYYShzUajTsR-cTW4CZ-UNDWZY2uE5PAgNbp-wn8Ogc,1874
12
12
  lamindb_setup/_init_instance.py,sha256=zJbkP22h4Yif_VNooL06FFoHqH1EU45CqiLwF8FUaKs,14368
13
- lamindb_setup/_migrate.py,sha256=x_b4k4XRfLSD-EEFMc324yK6DIK7goW33wUytbIWlNs,8917
13
+ lamindb_setup/_migrate.py,sha256=3R7j8DjZpZ4R4rloFulsqtkuNddIyRAj7Gvii9BvKz0,8830
14
14
  lamindb_setup/_register_instance.py,sha256=alQuYp2f8Ct8xvRC1gt8p_HZ0tqCd3gZD3kiPBLPpsI,1269
15
15
  lamindb_setup/_schema.py,sha256=b3uzhhWpV5mQtDwhMINc2MabGCnGLESy51ito3yl6Wc,679
16
16
  lamindb_setup/_schema_metadata.py,sha256=49wDLbhRhatDeADjHOPfQURt65lf_OZ7lob1ZiAT_ac,13773
@@ -41,7 +41,7 @@ lamindb_setup/core/exceptions.py,sha256=4NpLUNUIfXYVTFX2FvLZF8RW34exk2Vn2X3G4Yhn
41
41
  lamindb_setup/core/hashing.py,sha256=26dtak7XgmrWa_D1zuDyxObRQcriMtnc1yEigkKASmM,3142
42
42
  lamindb_setup/core/types.py,sha256=zJii2le38BJUmsNVvzDrbzGYr0yaeb-9Rw9IKmsBr3k,523
43
43
  lamindb_setup/core/upath.py,sha256=a0yxP9dmujTn_hkDC0E2UuVsX-Img4i0kVNB-OV5K1s,29038
44
- lamindb_setup-0.81.3.dist-info/LICENSE,sha256=UOZ1F5fFDe3XXvG4oNnkL1-Ecun7zpHzRxjp-XsMeAo,11324
45
- lamindb_setup-0.81.3.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
46
- lamindb_setup-0.81.3.dist-info/METADATA,sha256=VPKC024x5sheF1oT-iZRMb4k77WARFy2Y2PwA4Z_S9E,1730
47
- lamindb_setup-0.81.3.dist-info/RECORD,,
44
+ lamindb_setup-0.81.5.dist-info/LICENSE,sha256=UOZ1F5fFDe3XXvG4oNnkL1-Ecun7zpHzRxjp-XsMeAo,11324
45
+ lamindb_setup-0.81.5.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
46
+ lamindb_setup-0.81.5.dist-info/METADATA,sha256=8SQmhve8oc2imD0ZYKvK-5q6ZN70Hr5Op-n6NIb2uq4,1730
47
+ lamindb_setup-0.81.5.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: flit 3.9.0
2
+ Generator: flit 3.10.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any