CSV data file loading error: Invalid Attribute

  • I tried to import CSV data file with quotes & without quotes; both failed with the same error
  • Datetime format used is in RFC 3339 (ISO 8601)

Any help to t-shoot the issue is really appreciated.
Thanks

CSV data loading is failing, below is what we see in the server side logs

Invalid Attributes:      48468 [ERROR] (e.g. 8194:eventId,8195:eventId,8196:eventId,8197:eventId,8198:eventId,8199:eventId,8200:eventId,8201:eventId,8202:eventId,8203:eventId,8204:eventId,8205:eventId,8206:eventId,8207:eventId,8208:eventId,8209:eventId,8210:eventId,8211:eventId,8212:eventId,8213:eventId,8214:eventId,8215:eventId,8216:eventId,8217:eventId,8218:eventId,8219:eventId,8220:eventId,8221:eventId,8222:eventId,8223:eventId,8224:eventId,8225:eventId,8226:eventId,8227:eventId,8228:eventId,8229:eventId,8230:eventId,8231:eventId,8232:eventId,8233:eventId,8234:eventId,8235:eventId,8236:eventId,8237:eventId,8238:eventId,8239:eventId,8240:eventId,8241:eventId,8242:eventId,8243:eventId,8244:eventId,8245:eventId,8246:eventId,8247:eventId,8248:eventId,8249:eventId,8250:eventId,8251:eventId,8252:eventId,8253:eventId,8254:eventId,8255:eventId,8256:eventId,8257:eventId,8258:eventId,8259:eventId,8260:eventId,8261:eventId,8262:eventId,8263:eventId,8264:eventId,8265:eventId,8266:eventId,8267:eventId,8268:eventId,8269:eventId,8270:eventId,8271:eventId,8272:eventId,8273:eventId,8274:eventId,8275:eventId,8276:eventId,8277:eventId,8278:eventId,8279:eventId,8280:eventId,8281:eventId,8282:eventId,8283:eventId,8284:eventId,8285:eventId,8286:eventId,8287:eventId,8288:eventId,8289:eventId,8290:eventId,8291:eventId,8292:eventId,8293:eventId,8294:eventId,8295:eventId,8296:eventId,8297:eventId,8298:eventId,8299:eventId,8300:eventId,8301:eventId,8302:eventId,8303:eventId,8304:eventId,8305:eventId,8306:eventId,8307:eventId,8308:eventId,8309:eventId,8310:eventId,8311:eventId,8312:eventId,8313:eventId,8314:eventId,8315:eventId,8316:eventId,8317:eventId,8318:eventId,8319:eventId,8320:eventId,8321:eventId)
  1. Schema

    CREATE VERTEX MyVertex(PRIMARY_ID xid STRING, eventId INT, timestamp DATETIME)  WITH primary_id_as_attribute="true"
    
  2. CSV data snippet

    my.org/Patient/000cd66e-4a00-49bf-9270-668ded69a4e3/MyVertex/0, 0, 1970-01-01T00:00:00.000+00:00
    my.org/Patient/019f3b2a-fb58-ace8-e441-6b0e073a4d01/MyVertex/0, 0, 1970-01-01T00:00:00.000+00:00
    my.org/Patient/01a1b9c7-0b12-fede-37fc-39138c30adbe/MyVertex/0, 0, 1970-01-01T00:00:00.000+00:00
    my.org/Patient/01d18166-c298-15e4-cd58-7e6ea3fcb163/MyVertex/0, 0, 1970-01-01T00:00:00.000+00:00
    my.org/Patient/02c0e808-c82f-7a9d-98fb-ab7b758704ff/MyVertex/0, 0, 1970-01-01T00:00:00.000+00:00
    
  3. Job created and run from notebooks

     job_load_all_object_CSVs = '''
     USE GRAPH PatientCentral
     DROP JOB load_all_object_CSVs
     CREATE LOADING JOB load_all_object_CSVs FOR GRAPH PatientCentral {
     DEFINE FILENAME myvertex_CSVs_path="ALL:/coldstart/upload/pending_vertices/myvertex/";
     LOAD myvertex_CSVs_path TO VERTEX MyVertex VALUES($0, $1, $2) USING HEADER="false";
     }
     '''
     conn.gsql(job_load_all_object_CSVs)
    

Your DATETIME should be in 1970-01-01 00:00:00 format.

From Data Types :: Docs
DATETIME 1970-01-01 00:00:00 No literal. Can be converted from a correctly formatted string with to_datetime().

Just a note - if you don’t need the time component, think about switching from DATETIME to STRING or INT (i.e. 19700101) and use conversion during loading job, something like this:
left($2, 4) + substr($2, 5, 2) + substr($2, 8, 2)

Bruno

@Bruno_Simic thanks.

The eventId wasn’t parsed properly. The eventId is always coming as null, both with quotes or without quotes. Any clue?

  • The DATETIME worked after I removed literal in CSV data files
  • Now we are writing datetime to CSV files using yyyy-MM-dd HH:mm:ss format

try to remove the space between comma and 0 or use int($1) for loading.