Gda.DataModelImport¶
- Subclasses:
 None
Methods¶
- Inherited:
 - Structs:
 
class  | 
  | 
class  | 
  | 
class  | 
  | 
  | 
|
  | 
Virtual Methods¶
- Inherited:
 
Properties¶
Name  | 
Type  | 
Flags  | 
Short Description  | 
|---|---|---|---|
r/w/co  | 
String to import  | 
||
r/w/co  | 
File to import  | 
||
r/w/co  | 
Options to configure the import  | 
||
r/w/co  | 
Random access to the data model is possible  | 
||
r/w/c  | 
Consider missing or too much values an error  | 
||
r/w/co  | 
XML node to import from  | 
Signals¶
- Inherited:
 
Fields¶
- Inherited:
 
Name  | 
Type  | 
Access  | 
Description  | 
|---|---|---|---|
object  | 
r  | 
Class Details¶
- class Gda.DataModelImport(**kwargs)¶
 - Bases:
 - Abstract:
 No
- Structure:
 
- classmethod new_file(filename, random_access, options)¶
 - Parameters:
 - Returns:
 a pointer to the newly created
Gda.DataModel.- Return type:
 
Creates a new
Gda.DataModelobject which contains the data stored within the filename file.The options are the following ones:
For the CSV format:
ENCODING (string): specifies the encoding of the data in the file
SEPARATOR (string): specifies the CSV separator (comma as default)
QUOTE (string): specifies the character used as quote (double quote as default)
NAMES_ON_FIRST_LINE (boolean): consider that the first line of the file contains columns’ titles (note that the TITLE_AS_FIRST_LINE option is also accepted as a synonym)
G_TYPE_<column number> (
GObject.GType): specifies the type of value expected in column <column number>
Other formats: no option
Note: after the creation, please use
Gda.DataModelImport.get_errors() to check any error.
- classmethod new_mem(data, random_access, options)¶
 - Parameters:
 - Returns:
 a pointer to the newly created
Gda.DataModel.- Return type:
 
Creates a new
Gda.DataModelobject which contains the data stored in the data string.Important note: the data string is not copied for memory efficiency reasons and should not therefore be altered in any way as long as the returned data model exists.
- classmethod new_xml_node(node)¶
 - Parameters:
 node (
libxml2.NodePtr) – an XML node corresponding to a <data-array> tag- Returns:
 a pointer to the newly created
Gda.DataModel.- Return type:
 
Creates a new
Gda.DataModeland loads the data in node. The resulting data model can be accessed in a random way.
- clean_errors()¶
 Clears the history of errors self has to report
- get_errors()¶
 - Returns:
 the list of errors (which must not be modified), or
None- Return type:
 
Get the list of errors which self has to report. The returned list is a list of
GLib.Errorstructures, and must not be modified
Property Details¶
- Gda.DataModelImport.props.data_string¶
 - Name:
 data-string- Type:
 - Default Value:
 - Flags:
 
Data to import, as a string.
- Gda.DataModelImport.props.filename¶
 - Name:
 filename- Type:
 - Default Value:
 - Flags:
 
Name of the file to import.
- Gda.DataModelImport.props.options¶
 - Name:
 options- Type:
 - Default Value:
 - Flags:
 
Data model options.
- Gda.DataModelImport.props.random_access¶
 - Name:
 random-access- Type:
 - Default Value:
 - Flags:
 
Defines if the data model will be accessed randomly or through a cursor. If set to
False, access will have to be done using a cursor.
- Gda.DataModelImport.props.strict¶
 - 
Defines the behaviour in case the imported data contains recoverable errors (usually too many or too few data per row). If set to
True, an error will be reported and the import will stop, and if set toFalse, then the error will be reported but the import will not stop.New in version 4.2.1.
 
- Gda.DataModelImport.props.xml_node¶
 - Name:
 xml-node- Type:
 - Default Value:
 - Flags:
 
Data to import, as a pointer to an XML node (a
libxml2.NodePtr).