Python 2.7 has reached end of support
and will be
deprecated
on January 31, 2026. After deprecation, you won't be able to deploy Python 2.7
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing Python
2.7 applications will continue to run and receive traffic after their
deprecation date. We recommend that
you
migrate to the latest supported version of Python.
Stay organized with collections
Save and categorize content based on your preferences.
google.appengine.ext.bulkload.bulkload_deprecated module
Summary
DEPRECATED mix-in handler for bulk loading data into an application.
Please use the new bulkloader.
Contents
- class google.appengine.ext.bulkload.bulkload_deprecated.BulkLoadsource
-
Bases: google.appengine.ext.webapp._webapp25.RequestHandler
A handler for bulk load requests.
This class contains handlers for the bulkloading process. One for
GET to provide cookie information for the upload script, and one
handler for a POST request to upload the entities.
In the POST request, the body contains the data representing the
entities’ property values. The original format was a sequences of
lines of comma-separated values (and is handled by the Load
method). The current (version 1) format is a binary format described
in the Tools and Libraries section of the documentation, and is
handled by the LoadV1 method).
- InfoPage(uri)source
Renders an information page with the POST endpoint and cookie flag.
Parametersuri – a string containing the request URI
ReturnsA string with the contents of the info page to be displayed
- IterRows(reader)source
Yields a tuple of a line number and row for each row of the CSV data.
Parametersreader – a csv reader for the input data.
- Load(kind, data)source
Parses CSV data, uses a Loader to convert to entities, and stores them.
On error, fails fast. Returns a “bad request” HTTP response code and
includes the traceback in the output.
ParametersReturnsresponse code: integer HTTP response code to return
output: string containing the HTTP response body
Return typetuple (response code, output) where
- LoadEntities(iter, loader, key_format=None)source
Generates entities and loads them into the datastore. Returns
a tuple of HTTP code and string reply.
Parameters
-
iter – an iterator yielding pairs of a line number and row contents.
-
key_format – a format string to convert a line number into an
entity id. If None, then entity ID’s are automatically generated.
- get()source
-
Handle a GET. Just show an info page.
- post()source
-
Handle a POST. Reads CSV data, converts to entities, and stores them.
- class google.appengine.ext.bulkload.bulkload_deprecated.Loader(kind, properties)source
-
Bases: object
A base class for creating datastore entities from input data.
To add a handler for bulk loading a new entity kind into your datastore,
write a subclass of this class that calls Loader.__init__ from your
class’s __init__.
If you need to run extra code to convert entities from the input
data, create new properties, or otherwise modify the entities before
they’re inserted, override HandleEntity.
See the CreateEntity method for the creation of entities from the
(parsed) input data.
- CreateEntity(values, key_name=None)source
Creates an entity from a list of property values.
ParametersReturns
list of datastore.Entity
The returned entities are populated with the property values from the
argument, converted to native types using the properties map given in
the constructor, and passed through HandleEntity. They’re ready to be
inserted.
RaisesAssertionError if the number of values doesn’t match the number – of properties in the properties map.
- HandleEntity(entity)source
Subclasses can override this to add custom entity conversion code.
This is called for each entity, after its properties are populated from
CSV but before it is stored. Subclasses can override this to add custom
entity handling code.
The entity to be inserted should be returned. If multiple entities should
be inserted, return a list of entities. If no entities should be inserted,
return None or [].
Parametersentity – datastore.Entity
Returnsdatastore.Entity or list of datastore.Entity
- static RegisteredLoaders()source
-
Returns a list of the Loader instances that have been created.
- kind()source
-
Return the entity kind that this Loader handes.
- google.appengine.ext.bulkload.bulkload_deprecated.Validate(value, type)source
Checks that value is non-empty and of the right type.
Raises ValueError if value is None or empty, TypeError if it’s not the given
type.
Parameters
- google.appengine.ext.bulkload.bulkload_deprecated.main(*loaders)source
Starts bulk upload.
Raises TypeError if not, at least one Loader instance is given.
Parametersloaders – One or more Loader instance.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-16 UTC."],[[["\u003cp\u003eThe \u003ccode\u003ebulkload_deprecated\u003c/code\u003e module is a deprecated tool for bulk loading data into an application, and the new \u003ccode\u003ebulkloader\u003c/code\u003e module should be used instead.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eBulkLoad\u003c/code\u003e class is a request handler that manages both GET and POST requests for the bulk loading process, using the \u003ccode\u003eInfoPage\u003c/code\u003e, \u003ccode\u003eIterRows\u003c/code\u003e, \u003ccode\u003eLoad\u003c/code\u003e, \u003ccode\u003eLoadEntities\u003c/code\u003e, \u003ccode\u003eget\u003c/code\u003e and \u003ccode\u003epost\u003c/code\u003e methods.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eLoader\u003c/code\u003e class serves as a base for creating datastore entities from input data, and it includes methods like \u003ccode\u003eCreateEntity\u003c/code\u003e and \u003ccode\u003eHandleEntity\u003c/code\u003e for entity creation and modification.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eValidate\u003c/code\u003e function verifies that a given value is not empty and is of the correct data type.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003emain\u003c/code\u003e function initiates the bulk upload process using one or more \u003ccode\u003eLoader\u003c/code\u003e instances.\u003c/p\u003e\n"]]],[],null,["# google.appengine.ext.bulkload.bulkload_deprecated module\n========================================================\n\nSummary\n-------\n\nDEPRECATED mix-in handler for bulk loading data into an application.\n\nPlease use the new bulkloader.\n\nContents\n--------\n\n*class* google.appengine.ext.bulkload.bulkload_deprecated.BulkLoad[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/bulkload/bulkload_deprecated#BulkLoad)\n\n: Bases: google.appengine.ext.webapp._webapp25.RequestHandler\n\n A handler for bulk load requests.\n\n This class contains handlers for the bulkloading process. One for\n GET to provide cookie information for the upload script, and one\n handler for a POST request to upload the entities.\n\n In the POST request, the body contains the data representing the\n entities' property values. The original format was a sequences of\n lines of comma-separated values (and is handled by the Load\n method). The current (version 1) format is a binary format described\n in the Tools and Libraries section of the documentation, and is\n handled by the LoadV1 method). \n\n InfoPage(uri)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/bulkload/bulkload_deprecated#BulkLoad.InfoPage)\n\n : Renders an information page with the POST endpoint and cookie flag.\n\n Parameters\n\n uri -- a string containing the request URI\n Returns\n\n A string with the contents of the info page to be displayed \n\n IterRows(reader)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/bulkload/bulkload_deprecated#BulkLoad.IterRows)\n\n : Yields a tuple of a line number and row for each row of the CSV data.\n\n Parameters\n\n reader -- a csv reader for the input data. \n\n Load(kind, data)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/bulkload/bulkload_deprecated#BulkLoad.Load)\n\n : Parses CSV data, uses a Loader to convert to entities, and stores them.\n\n On error, fails fast. Returns a \"bad request\" HTTP response code and\n includes the traceback in the output.\n Parameters\n\n - kind -- a string containing the entity kind that this loader handles\n\n - data -- a string containing the CSV data to load\n\n Returns\n\n response code: integer HTTP response code to return\n output: string containing the HTTP response body\n Return type\n\n tuple (response code, output) where \n\n LoadEntities(iter, loader, key_format=None)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/bulkload/bulkload_deprecated#BulkLoad.LoadEntities)\n\n : Generates entities and loads them into the datastore. Returns\n a tuple of HTTP code and string reply.\n\n Parameters\n\n - iter -- an iterator yielding pairs of a line number and row contents.\n\n - key_format -- a format string to convert a line number into an\n entity id. If None, then entity ID's are automatically generated.\n\n get()[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/bulkload/bulkload_deprecated#BulkLoad.get)\n\n : Handle a GET. Just show an info page.\n\n post()[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/bulkload/bulkload_deprecated#BulkLoad.post)\n\n : Handle a POST. Reads CSV data, converts to entities, and stores them.\n\n*class* google.appengine.ext.bulkload.bulkload_deprecated.Loader(kind, properties)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/bulkload/bulkload_deprecated#Loader)\n\n: Bases: object\n\n A base class for creating datastore entities from input data.\n\n To add a handler for bulk loading a new entity kind into your datastore,\n write a subclass of this class that calls Loader.__init__ from your\n class's __init__.\n\n If you need to run extra code to convert entities from the input\n data, create new properties, or otherwise modify the entities before\n they're inserted, override HandleEntity.\n\n See the CreateEntity method for the creation of entities from the\n (parsed) input data. \n\n CreateEntity(values, key_name=None)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/bulkload/bulkload_deprecated#Loader.CreateEntity)\n\n : Creates an entity from a list of property values.\n\n Parameters\n\n - values -- list/tuple of str\n\n - key_name -- if provided, the name for the (single) resulting Entity\n\n Returns\n\n\n list of datastore.Entity\n\n The returned entities are populated with the property values from the\n argument, converted to native types using the properties map given in\n the constructor, and passed through HandleEntity. They're ready to be\n inserted.\n\n \u003cbr /\u003e\n\n Raises\n\n AssertionError if the number of values doesn't match the number -- of properties in the properties map. \n\n HandleEntity(entity)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/bulkload/bulkload_deprecated#Loader.HandleEntity)\n\n : Subclasses can override this to add custom entity conversion code.\n\n This is called for each entity, after its properties are populated from\n CSV but before it is stored. Subclasses can override this to add custom\n entity handling code.\n\n The entity to be inserted should be returned. If multiple entities should\n be inserted, return a list of entities. If no entities should be inserted,\n return None or \\[\\].\n Parameters\n\n entity -- datastore.Entity\n Returns\n\n datastore.Entity or list of datastore.Entity \n\n *static* RegisteredLoaders()[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/bulkload/bulkload_deprecated#Loader.RegisteredLoaders)\n\n : Returns a list of the Loader instances that have been created.\n\n kind()[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/bulkload/bulkload_deprecated#Loader.kind)\n\n : Return the entity kind that this Loader handes.\n\ngoogle.appengine.ext.bulkload.bulkload_deprecated.Validate(value, type)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/bulkload/bulkload_deprecated#Validate)\n\n: Checks that value is non-empty and of the right type.\n\n Raises ValueError if value is None or empty, TypeError if it's not the given\n type.\n Parameters\n\n - value -- any value\n\n - type -- a type or tuple of types\n\ngoogle.appengine.ext.bulkload.bulkload_deprecated.main(\\*loaders)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/ext/bulkload/bulkload_deprecated#main)\n\n: Starts bulk upload.\n\n Raises TypeError if not, at least one Loader instance is given.\n Parameters\n\n loaders -- One or more Loader instance."]]