Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pampa_web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Touzet Hélène
pampa_web
Commits
94d54db8
Commit
94d54db8
authored
1 year ago
by
Hernandez-Courbevoie Yohan
Browse files
Options
Downloads
Patches
Plain Diff
Fix the table and json build
parent
b2bb93a9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
postgresql/fill_taxo.py
+1
-1
1 addition, 1 deletion
postgresql/fill_taxo.py
postgresql/json_taxo.py
+2
-2
2 additions, 2 deletions
postgresql/json_taxo.py
with
3 additions
and
3 deletions
postgresql/fill_taxo.py
+
1
−
1
View file @
94d54db8
...
...
@@ -63,7 +63,7 @@ def insert_data(table, raw):
try
:
with
psycopg2
.
connect
(
**
config
)
as
conn
:
with
conn
.
cursor
()
as
cur
:
cur
.
execute
(
sql
,
(
table
,
taxoId
,
commonName
,
scientificName
,
parentId
,
rank
))
cur
.
execute
(
sql
,
(
taxoId
,
commonName
,
scientificName
,
parentId
,
rank
))
conn
.
commit
()
except
(
Exception
,
psycopg2
.
DatabaseError
)
as
error
:
print
(
error
)
...
...
This diff is collapsed.
Click to expand it.
postgresql/json_taxo.py
+
2
−
2
View file @
94d54db8
...
...
@@ -56,7 +56,7 @@ def add_childs(cur, table, json, id):
# print(sql)
childrens
=
[]
try
:
cur
.
execute
(
sql
,
(
table
)
)
cur
.
execute
(
sql
)
rows
=
cur
.
fetchall
()
# idx = 0
# print("rowcount",cur.rowcount)
...
...
@@ -68,7 +68,7 @@ def add_childs(cur, table, json, id):
json_object
=
{
"
id
"
:
new_id
,
"
text
"
:
text
,
"
children
"
:
[]}
state
=
{
"
opened
"
:
"
false
"
,
"
disabled
"
:
"
true
"
}
json_object
[
"
state
"
]
=
state
add_childs
(
cur
,
json_object
,
new_id
)
add_childs
(
cur
,
table
,
json_object
,
new_id
)
childrens
.
append
(
json_object
)
json
[
"
children
"
]
=
childrens
...
...
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