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

🔧 Use LAMINDB_DJANGO_DATABASE_URL instead of DATABASE_URL #852

Merged
merged 3 commits into from
Sep 12, 2024

Conversation

Koncopd
Copy link
Member

@Koncopd Koncopd commented Sep 12, 2024

No description provided.

Copy link

codecov bot commented Sep 12, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 83.43%. Comparing base (db0d9a0) to head (5eb5c3d).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
lamindb_setup/core/_settings_instance.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #852      +/-   ##
==========================================
- Coverage   83.45%   83.43%   -0.02%     
==========================================
  Files          43       43              
  Lines        3355     3357       +2     
==========================================
+ Hits         2800     2801       +1     
- Misses        555      556       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Sep 12, 2024

@github-actions github-actions bot temporarily deployed to pull request September 12, 2024 07:57 Inactive
@@ -333,6 +333,10 @@ def _check_sqlite_lock(self):
@property
def db(self) -> str:
"""Database connection string (URI)."""
if "LAMINDB_DATABASE_URL" in os.environ:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be called LAMINDB_INSTANCE_DB, because that's what it's called in pydantic, which has the same behavior.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(It also let's a set env variable take supersede whatever is in the .env file.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, this is yet another env varibale here

db_dsn_local = LaminDsnModel(db=os.getenv("LAMINDB_INSTANCE_DB"))
i wasn't aware

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then need to rework this a bit.

@Koncopd
Copy link
Member Author

Koncopd commented Sep 12, 2024

Hm, i am not sure now that it is better to point to already existing LAMINDB_INSTANCE_DB. LAMINDB_INSTANCE_DB is actually a proper thing, that is validated. And this one (LAMINDB_DATABASE_URL) is just something that overwrites any connection whatever it is. They should not be conflated i believe. And also double overwrite will be confusing we use LAMINDB_INSTANCE_DB here.

@falexwolf maybe lets call it not LAMINDB_DATABASE_URL but something like LAMINDB_DJANGO_DATABASE_URL just to be sure that is not accidently used, because DATABASE_URL is really generic.

@Koncopd Koncopd changed the title 🔧 Use LAMINDB_DATABASE_URL istead of DATABASE_URL 🔧 Use LAMINDB_DJANGO_DATABASE_URL istead of DATABASE_URL Sep 12, 2024
@Koncopd Koncopd changed the title 🔧 Use LAMINDB_DJANGO_DATABASE_URL istead of DATABASE_URL 🔧 Use LAMINDB_DJANGO_DATABASE_URL instead of DATABASE_URL Sep 12, 2024
@falexwolf
Copy link
Member

I like your last solution!

@github-actions github-actions bot temporarily deployed to pull request September 12, 2024 09:52 Inactive
@Koncopd
Copy link
Member Author

Koncopd commented Sep 12, 2024

Ok, merging then.

@Koncopd Koncopd merged commit cb12582 into main Sep 12, 2024
11 of 13 checks passed
@Koncopd Koncopd deleted the env_db_url branch September 12, 2024 09:54
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

Successfully merging this pull request may close these issues.

2 participants