{ "info": { "author": "Wolfang Torres", "author_email": "wolfang.torres@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# SQL_XML_TABLE #\n\nAn object that allows you to easily create and work with tables, while also importing/exporting them from/to SQL databases or XML files, it can serve as a way to send data back and ford between XML files and SQL databases.\n\n\n\n```\n#!python\n\n>From sql_xml_table import Table\n```\n\n\nIt defines an object called Table, it can be created with a name for identification an a pre-created connection object of a pep-246 compatible database interface.\n\n\n```\n#!python\n\ntable = Table('Animals') \n```\n\nThen you need to add columns with the agregar_columna (add_column) method, with can take various key word arguments:\n\n - campo (field): the name of the field\n\n - tipo (type): the type of data stored, can be a things like 'varchar' and 'double' or name of python objects if you aren't interested in exporting to a data base latter.\n\n - defecto (default): set a default value for the column if there is none when you add a row\n\n - there are other 3 but are only there for database tings and not actually functional\n\nlike:\n\n\n```\n#!python\nTable.agregar_columna(campo='Name', tipo='str')\nTable.agregar_columna(campo='Year', tipo='date')\n\ndeclaring it date, time, datetime or timestamp is important for being able to store it as a time object and not only as a number, But you can always put it as a int if you don't care for dates\n\nTable.agregar_columna(campo='Priority', tipo='int')\n```\n\nThen you add the rows with the += operator (or + if you want to create a copy with an extra row)\n\n\n```\n#!python\n\nTable += ('Cat', date(1998,1,1), 1)\nTable += {'Year':date(1998,1,1), 'Priority':2, Name:'Fish'}\n#\u00e2\u20ac\u00a6\n#The condition for adding is that is a container accessible with either the column name or the position of the column in the table\n```\n\nThen you can generate XML and write it to a file with exportar_XML (export_XML) and escribir_XML (write_XML):\n\n\n```\n#!python\n\nfile = os.path.abspath(os.path.join(os.path.dirname(__file__), 'Animals.xml'))\nTable.exportar_xml()\nTable.escribir_xml(file)\n```\n\n\nAnd then import it back with importar_XML (import_XML) with the file name and indication that you are using a file and not an string literal:\n\n\n```\n#!python\n\nTable.importar_xml(file, tipo='archivo')\n#archivo means file\n```\n\n\n# Advanced #\n\nThis are ways you can use a Table object in a SQL manner.\n\n## UPDATE