Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0034094Openbravo ERPY. DBSourceManagerpublic2016-09-26 18:022016-11-25 17:38
AugustoMauch 
AugustoMauch 
normalminorhave not tried
closedduplicate 
5
 
 
No
Core
No
0034094: Support exporting and importing sampledata using PostgreSQL's COPY
PostgreSQL provides a fast way to export and import from the database to CSV files using its COPY functionality [1].

It would be great if the ExportSampledata and ImportSampledata classes could be adapted to optionally export/import using PostgreSQL's COPY.

As this functionality is not available as is in Oracle, the export and import tasks will only work with XML in this platform.

[1] https://www.postgresql.org/docs/9.4/static/sql-copy.html [^]
-
No tags attached.
duplicate of feature request 0033875 closed AugustoMauch Importing/Exporting sample data using PostgreSQL's COPY instead of current XML 
Issue History
2016-09-26 18:02AugustoMauchNew Issue
2016-09-26 18:02AugustoMauchAssigned To => platform
2016-09-26 18:02AugustoMauchOBNetwork customer => No
2016-09-26 18:02AugustoMauchModules => Core
2016-09-26 18:02AugustoMauchTriggers an Emergency Pack => No
2016-09-26 18:02AugustoMauchAssigned Toplatform => AugustoMauch
2016-10-28 13:47AugustoMauchRelationship addedduplicate of 0033875
2016-10-28 13:47AugustoMauchStatusnew => closed
2016-10-28 13:47AugustoMauchResolutionopen => duplicate
2016-11-25 17:38hgbotCheckin
2016-11-25 17:38hgbotNote Added: 0091857
2016-11-25 17:38hgbotCheckin
2016-11-25 17:38hgbotNote Added: 0091858

Notes
(0091857)
hgbot   
2016-11-25 17:38   
Repository: erp/devel/dbsm-main
Changeset: 3f7817dd375e67085af81a188e0198d354ce4230
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Sep 20 12:44:04 2016 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/3f7817dd375e67085af81a188e0198d354ce4230 [^]

Related with issue 34094: export.sample.data can export using PG copy format

An exportFormat parameter can be specified to the export.sample.data task, its supported values are xml (as usual) and copy (uses PostgreSQL's COPY to export to CSV). The copy export format is only supported in PostgreSQL, if the underlying database is Oracle then the xml format is always used.

This is a summary of the changes:
- src/org/apache/ddlutils/io/DataSetTableExporter: A new interface to be implemented by the classes that are going to export the database tables in different formats.i
- src/org/apache/ddlutils/io/DatabaseDataIO.java: It implements now the DataSetTableExporter. The implementation of the required method invokes writeDataForTableToXML, the method that has been used so far to export a dataset table to XML
- src/org/apache/ddlutils/io/PgCopyDatabaseDataIO.java: A new class that implementes DataSetTableExporter and that exports a dataset table to CSV using PostgreSQL's copy.
- src/org/openbravo/ddlutils/task/ExportSampledata.java: It accepts now an exportFormat parameter. Uses that parameter to determine the extension of the files that will be created and the DataSetTableExporter that should be uses to export the dataset tables.

---
M src/org/apache/ddlutils/io/DatabaseDataIO.java
M src/org/openbravo/ddlutils/task/ExportSampledata.java
A src/org/apache/ddlutils/io/DataSetTableExporter.java
A src/org/apache/ddlutils/io/PgCopyDatabaseDataIO.java
---
(0091858)
hgbot   
2016-11-25 17:38   
Repository: erp/devel/dbsm-main
Changeset: 56dccf20d76bf7d8e8a1df9d6b5f0bae965aa40a
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Sep 27 11:43:15 2016 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/56dccf20d76bf7d8e8a1df9d6b5f0bae965aa40a [^]

Related with issue 34094: import.sample.data can import using PG copy format

The import.sample.data now supports importing .copy files that have been generated using the export.sample.data task with the .copy file extension. It only works in PostgreSQL, in Oracle those files will be skipped.

Summary of the changes:
- src/org/apache/ddlutils/io/PgCopyDatabaseDataIO.java: Adds the method that actually imports a .copy into the database using PostgreSQL's COPY
- src/org/openbravo/ddlutils/task/DatabaseUtils.java: Adds a filter to read .copy files from the reference data folder. Before this change only the .xml files were considered.
- src/org/openbravo/ddlutils/task/ImportSampledata.java: Reads both .copy and .xml files from the reference data folder. Depending on the extensions it uses DatabaseDataIO or PgCopyDatabaseDataIO to import the file into the database.

---
M src/org/apache/ddlutils/io/PgCopyDatabaseDataIO.java
M src/org/openbravo/ddlutils/task/DatabaseUtils.java
M src/org/openbravo/ddlutils/task/ImportSampledata.java
---