Import XML to SQL Database

I am working with a 20 gigabyte XML file that I would like to import into an SQL database (preferably MySQL, as this is what I know). It seems like this will be a common task, but after thinking a little bit about Google Googling, I couldn't figure out how to do it. What is the best way to do this?

I know that this ability is built into MySQL 6.0, but now this is not an option, because this is an alpha version of the development.

Also, if I need to do any scripting, I would prefer to use Python, because that is what I am most familiar with.

Thanks.

+5
source share
5 answers

getiterator() XML . ElementTree, , lxml.

for record in root.getiterator('record'):
    add_element_to_database(record) # Depends on your database interface.
                                    # I recommend SQLAlchemy.
+4

iterparse() ElementTree cElementTree (, cElementTree , )

, : http://effbot.org/zone/element-iterparse.htm#incremental-parsing

, , Python. .clear() ( 20- xml : .getiterator(), , , - , iterparse())

+2

Python, XML . ElementTree - XML Python, . , XML , .

+1

, , , 20 MySQL, SQL Server.

SQL Server . , - , , 20 XML . ? ?

SQL Server XML, XML XML. XQuery, XML- XML XML " ", XML-, .

0

MySQL, , , XML 6. , -, 5.

0

All Articles