Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
django-diu
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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
Hervé MENAGER
django-diu
Commits
d91f5113
Commit
d91f5113
authored
5 years ago
by
Hervé MENAGER
Browse files
Options
Downloads
Patches
Plain Diff
add XML import class
parent
2911b167
No related branches found
No related tags found
No related merge requests found
Pipeline
#24723
passed
5 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
django_diu/import_command.py
+17
-0
17 additions, 0 deletions
django_diu/import_command.py
with
17 additions
and
0 deletions
django_diu/import_command.py
+
17
−
0
View file @
d91f5113
...
@@ -8,6 +8,8 @@ from django.core.management import BaseCommand, CommandError
...
@@ -8,6 +8,8 @@ from django.core.management import BaseCommand, CommandError
import
mysql.connector
import
mysql.connector
import
requests_cache
import
requests_cache
import
click
import
click
import
xml.etree.ElementTree
as
ET
class
MyConverter
(
mysql
.
connector
.
conversion
.
MySQLConverter
):
class
MyConverter
(
mysql
.
connector
.
conversion
.
MySQLConverter
):
...
@@ -158,6 +160,21 @@ class DataFrameImportTask(ImportTask):
...
@@ -158,6 +160,21 @@ class DataFrameImportTask(ImportTask):
self
.
source_count
=
self
.
dataframe
.
shape
[
0
]
self
.
source_count
=
self
.
dataframe
.
shape
[
0
]
class
XMLImportTask
(
ImportTask
):
description
=
"
Abstract XML import task
"
xmlFile
=
None
xpathSelector
=
"
*
"
def
open_data_source
(
self
):
tree
=
ET
.
parse
(
argv
[
1
])
root
=
tree
.
getroot
()
self
.
rows
=
root
.
findall
(
self
.
xpathSelector
)
def
count_source
(
self
):
self
.
source_count
=
len
(
self
.
rows
)
class
ImportCommand
(
BaseCommand
):
class
ImportCommand
(
BaseCommand
):
help
=
"
Generic command to import data into a django database
"
help
=
"
Generic command to import data into a django database
"
...
...
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