Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Postgresql crud operations
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vipul.v
Postgresql crud operations
Commits
a626b777
Commit
a626b777
authored
Mar 27, 2023
by
vipul.v
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crud operation second
parent
c1a70b22
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
18 deletions
+19
-18
.idea/sonarlint/issuestore/index.pb
.idea/sonarlint/issuestore/index.pb
+1
-5
.idea/sonarlint/securityhotspotstore/index.pb
.idea/sonarlint/securityhotspotstore/index.pb
+1
-5
conf/application.conf
conf/application.conf
+1
-1
script/utils/inventory_utils.py
script/utils/inventory_utils.py
+16
-7
No files found.
.idea/sonarlint/issuestore/index.pb
View file @
a626b777
...
@@ -4,8 +4,4 @@ N
...
@@ -4,8 +4,4 @@ N
\
\
,.idea/inspectionProfiles/Project_Default.xml,4\9\496a238a6afa168dbaf6efd37bb459331589579c
,.idea/inspectionProfiles/Project_Default.xml,4\9\496a238a6afa168dbaf6efd37bb459331589579c
^
^
..idea/inspectionProfiles/profiles_settings.xml,1\e\1e9075f5bf079c01ef2c910709e91a497d262080
..idea/inspectionProfiles/profiles_settings.xml,1\e\1e9075f5bf079c01ef2c910709e91a497d262080
4
\ No newline at end of file
.env,3\c\3c84dcdc6bbe3d7817c49dcdc327b926fea1808a
E
conf/application.conf,6\4\644f59db746795ef1538ef95c4cbc0eab6663e28
\ No newline at end of file
.idea/sonarlint/securityhotspotstore/index.pb
View file @
a626b777
...
@@ -4,8 +4,4 @@ N
...
@@ -4,8 +4,4 @@ N
\
\
,.idea/inspectionProfiles/Project_Default.xml,4\9\496a238a6afa168dbaf6efd37bb459331589579c
,.idea/inspectionProfiles/Project_Default.xml,4\9\496a238a6afa168dbaf6efd37bb459331589579c
^
^
..idea/inspectionProfiles/profiles_settings.xml,1\e\1e9075f5bf079c01ef2c910709e91a497d262080
..idea/inspectionProfiles/profiles_settings.xml,1\e\1e9075f5bf079c01ef2c910709e91a497d262080
4
\ No newline at end of file
.env,3\c\3c84dcdc6bbe3d7817c49dcdc327b926fea1808a
E
conf/application.conf,6\4\644f59db746795ef1538ef95c4cbc0eab6663e28
\ No newline at end of file
conf/application.conf
View file @
a626b777
[
POSTGRESQL
]
[
POSTGRESQL
]
host
=
127
.
0
.
0
.
1
host
=
127
.
0
.
0
.
1
port
=
7999
port
=
8000
user
=
"interns"
user
=
"interns"
password
=
"interns@123"
password
=
"interns@123"
\ No newline at end of file
script/utils/inventory_utils.py
View file @
a626b777
from
sqlalchemy
import
Column
,
Integer
,
String
,
MetaData
,
text
from
sqlalchemy
import
Column
,
Integer
,
String
,
MetaData
,
text
,
inspect
from
sqlalchemy
import
Table
from
sqlalchemy
import
Table
from
script.core.db.postgresql_connector
import
session
from
script.core.db.postgresql_connector
import
session
,
engine
from
script.core.schema.inventory
import
Inventory
from
script.core.schema.inventory
import
Inventory
,
Base
metadata
=
MetaData
()
metadata
=
MetaData
()
...
@@ -34,12 +34,21 @@ class SqlUtility:
...
@@ -34,12 +34,21 @@ class SqlUtility:
@
staticmethod
@
staticmethod
def
fetch_file
():
def
fetch_file
():
try
:
try
:
inspector
=
inspect
(
engine
)
columns
=
inspector
.
get_columns
(
'inventory_data'
)
column_names
=
[
c
[
'name'
]
for
c
in
columns
]
inventory_data
=
session
.
query
(
Inventory
)
.
all
()
inventory_data
=
session
.
query
(
Inventory
)
.
all
()
list_
=
[]
body
=
[]
for
data
in
inventory_data
:
for
data
in
inventory_data
:
list_
.
append
({
"order_id"
:
data
.
order_id
,
"customer_name"
:
data
.
customer_name
,
"status"
:
data
.
status
,
row
=
{}
"sales_order"
:
data
.
sales_order
})
for
column_name
in
column_names
:
return
list_
row
[
column_name
]
=
getattr
(
data
,
column_name
)
body
.
append
(
row
)
header
=
[]
for
column_name
in
column_names
:
title_name
=
column_name
.
replace
(
'_'
,
' '
)
.
title
()
header
.
append
({
"label"
:
title_name
,
"value"
:
column_name
})
return
{
"headerContent"
:
header
,
"bodyContent"
:
body
}
except
Exception
as
e
:
except
Exception
as
e
:
print
(
e
,
"Error detected in updating"
)
print
(
e
,
"Error detected in updating"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment