Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LabelsTower
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MaitresNageurs
README
LabelsTower
Commits
a7f25d7d
Commit
a7f25d7d
authored
5 years ago
by
erichard
Browse files
Options
Downloads
Patches
Plain Diff
Accès à la base de données par os.environ['DATABASE']
parent
87419c4a
No related branches found
No related tags found
2 merge requests
!61
Packager labelstower
,
!60
WIP: Implement sqlalchemy
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/getter.py
+3
-1
3 additions, 1 deletion
app/getter.py
with
3 additions
and
1 deletion
app/getter.py
+
3
−
1
View file @
a7f25d7d
import
os
from
typing
import
Dict
,
List
from
typing
import
Dict
,
List
from
flask
import
current_app
def
get_selected_elements
(
id_mandatory_labels
:
int
,
id_forbiden_labels
:
str
,
number_of_mandatory_labels
:
str
)
->
List
[
Dict
[
int
,
str
]]
:
def
get_selected_elements
(
id_mandatory_labels
:
int
,
id_forbiden_labels
:
str
,
number_of_mandatory_labels
:
str
)
->
List
[
Dict
[
int
,
str
]]
:
"""
"""
...
@@ -198,7 +200,7 @@ def send_query_to_db(query: str) -> List[Dict[int, str]] :
...
@@ -198,7 +200,7 @@ def send_query_to_db(query: str) -> List[Dict[int, str]] :
'''
'''
import
sqlite3
import
sqlite3
result
=
[]
result
=
[]
with
sqlite3
.
connect
(
'
app/voiture.db
'
)
as
connexion
:
with
sqlite3
.
connect
(
os
.
path
.
join
(
'
app
'
,
current_app
.
config
[
'
DATABASE
'
])
)
as
connexion
:
cursor
=
connexion
.
cursor
()
cursor
=
connexion
.
cursor
()
response
=
cursor
.
execute
(
query
)
response
=
cursor
.
execute
(
query
)
for
row
in
response
:
for
row
in
response
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment