Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
index_info_script
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
tarun.madamanchi
index_info_script
Commits
49e8cd67
Commit
49e8cd67
authored
Apr 23, 2025
by
OWAIZ MUSTAFA KHAN
😎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix: Formating index info to readable data
parent
eebb6b5e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
4 deletions
+30
-4
.gitignore
.gitignore
+27
-1
index_operations_v2.py
index_operations_v2.py
+1
-1
scripts/schemas/__pycache__/mongo_schema.cpython-311.pyc
scripts/schemas/__pycache__/mongo_schema.cpython-311.pyc
+0
-0
scripts/utils/__pycache__/mongo_utils_v2.cpython-311.pyc
scripts/utils/__pycache__/mongo_utils_v2.cpython-311.pyc
+0
-0
scripts/utils/mongo_utils_v2.py
scripts/utils/mongo_utils_v2.py
+2
-2
No files found.
.gitignore
View file @
49e8cd67
.venv
.idea
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
bin/
build/
develop-eggs/
dist/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
\ No newline at end of file
index_operations_v2.py
View file @
49e8cd67
...
...
@@ -81,7 +81,7 @@ def delete_index_not_in_db(payload: DeleteIndexNotInDB):
collections_info
=
list
(
metadata_collection
.
find
({},
{
'_id'
:
0
}))
for
collection_info
in
collections_info
:
index_infos
=
get_index_info
(
collection_info
)
index_infos
=
get_index_info
(
collection_info
,
for_delete
=
True
)
collection
=
get_collection
(
collection_info
.
get
(
...
...
scripts/schemas/__pycache__/mongo_schema.cpython-311.pyc
View file @
49e8cd67
No preview for this file type
scripts/utils/__pycache__/mongo_utils_v2.cpython-311.pyc
View file @
49e8cd67
No preview for this file type
scripts/utils/mongo_utils_v2.py
View file @
49e8cd67
...
...
@@ -61,7 +61,7 @@ def get_collection_info(index: dict):
db_name
=
index
.
get
(
'database'
,
index
.
get
(
'db'
,
index
.
get
(
'db_name'
)))
return
collection_name
,
db_name
def
get_index_info
(
collection_info
:
dict
)
->
list
[
dict
]:
def
get_index_info
(
collection_info
:
dict
,
for_delete
:
bool
=
False
)
->
list
[
dict
]:
collection_name
,
db_name
=
get_collection_info
(
collection_info
)
collection
=
get_collection
(
collection_name
,
db_name
)
...
...
@@ -71,7 +71,7 @@ def get_index_info(collection_info: dict) -> list[dict]:
# Format to readable data
index_infos
=
[
{
"name"
:
idx
[
"name"
],
"fields"
:
[[
k
,
1
if
v
==
'ASC'
else
'DESC'
]
for
k
,
v
in
idx
[
"key"
]
.
items
()]}
{
"name"
:
idx
[
"name"
],
"fields"
:
[[
k
,
(
'ASC'
if
v
==
1
else
'DESC'
)
if
for_delete
else
(
1
if
v
==
'ASC'
else
-
1
)
]
for
k
,
v
in
idx
[
"key"
]
.
items
()]}
for
idx
in
add_index_list
]
...
...
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