Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi @all
I am trying to load a qvd but only retain the columns and empty out the table
The code below works but it reads all the data first then drop then it. but is proving time consuming because of the size of the QVD 15gb.
LOAD
*
FROM $(QVD_File) #this is variable that points to the qvd file
WHERE 1=0;
Is there a more efficient way of pulling just the columns similar to df.columns in python
df.columns
Not sure if this is most elegant way, but following my suggestion. You just need to replace the variables vTableName and vQVDFilename.
SET vTableName = 'CUSTOMER_NEW';
SET vQVDFilename = 'lib://DataFiles/CUSTOMER_NEW.qvd';
[TempLoadStatement]:
LOAD
CONCAT([FieldName],',') AS [LoadStatement]
FROM
[$(vQVDFilename)]
(XmlSimple, table is [QvdTableHeader/Fields/QvdFieldHeader])
;
LET vLoadStatement = FieldValue('LoadStatement',1);
[$(vTableName)]:
LOAD * INLINE [
$(vLoadStatement)
];
STORE [$(vTableName)] INTO [$(vQVDFilename)](qvd);
DROP TABLES
[TempLoadStatement],
[$(vTableName)]
;
Not sure if this is most elegant way, but following my suggestion. You just need to replace the variables vTableName and vQVDFilename.
SET vTableName = 'CUSTOMER_NEW';
SET vQVDFilename = 'lib://DataFiles/CUSTOMER_NEW.qvd';
[TempLoadStatement]:
LOAD
CONCAT([FieldName],',') AS [LoadStatement]
FROM
[$(vQVDFilename)]
(XmlSimple, table is [QvdTableHeader/Fields/QvdFieldHeader])
;
LET vLoadStatement = FieldValue('LoadStatement',1);
[$(vTableName)]:
LOAD * INLINE [
$(vLoadStatement)
];
STORE [$(vTableName)] INTO [$(vQVDFilename)](qvd);
DROP TABLES
[TempLoadStatement],
[$(vTableName)]
;
Thanks