Skip to content

Commit 54d1c97

Browse files
committed
renamed var database & cleaned imports and README
1 parent 4f27c65 commit 54d1c97

3 files changed

Lines changed: 10 additions & 12 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h1 align="center">OpenGeodeWeb-Back<sup><i>by Geode-solutions</i></sup></h1>
1+
<h1 align="center">OpenGeodeWeb-Microservice<sup><i>by Geode-solutions</i></sup></h1>
22
<h3 align="center">OpenSource Python framework based on OpenGeode</h3>
33

44
<p align="center">

src/opengeodeweb_microservice/database/base.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from flask import Flask
2-
from flask_sqlalchemy import SQLAlchemy
31
from sqlalchemy.orm import DeclarativeBase
42

53

src/opengeodeweb_microservice/database/connection.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@
88
from .base import Base
99

1010
DATABASE_FILENAME = "project.db"
11-
db: Optional[SQLAlchemy] = None
11+
database: Optional[SQLAlchemy] = None
1212

1313

1414
def init_database(app: Flask, db_filename: str = DATABASE_FILENAME) -> SQLAlchemy:
15-
global db
16-
if db is None:
17-
db = SQLAlchemy(model_class=Base)
18-
db.init_app(app)
15+
global database
16+
if database is None:
17+
database = SQLAlchemy(model_class=Base)
18+
database.init_app(app)
1919
with app.app_context():
20-
db.create_all()
21-
return db
20+
database.create_all()
21+
return database
2222

2323

2424
def get_database() -> Optional[SQLAlchemy]:
25-
return db
25+
return database
2626

2727

2828
def get_session() -> Optional[scoped_session[Session]]:
29-
return db.session if db else None
29+
return database.session if database else None

0 commit comments

Comments
 (0)