Bulk Upload not working for Polymodel in appengine datastore - google-app-engine

Bulk upload for an Entity of type db.polymodel.PolyModel fails with the following error (I have managed to upload other Entities and all imports should be present):
[INFO ] Logging to bulkloader-log-20130901.191015
[INFO ] Throttling transfers:
[INFO ] Bandwidth: 250000 bytes/second
[INFO ] HTTP connections: 8/second
[INFO ] Entities inserted/fetched/modified: 20/second
[INFO ] Batch Size: 10
Traceback (most recent call last):
File "c:/program files (x86)/google/google_appengine/appcfg.py", line 171, in
<module>
run_file(__file__, globals())
File "c:/program files (x86)/google/google_appengine/appcfg.py", line 167, in
run_file
execfile(script_path, globals_)
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\ap
pcfg.py", line 4252, in <module>
main(sys.argv)
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\ap
pcfg.py", line 4243, in main
result = AppCfgApp(argv).Run()
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\ap
pcfg.py", line 2402, in Run
self.action(self)
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\ap
pcfg.py", line 3979, in __call__
return method()
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\ap
pcfg.py", line 3791, in PerformUpload
run_fn(args)
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\ap
pcfg.py", line 3682, in RunBulkloader
sys.exit(bulkloader.Run(arg_dict))
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\bu
lkloader.py", line 4395, in Run
return _PerformBulkload(arg_dict)
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\bu
lkloader.py", line 4206, in _PerformBulkload
LoadConfig(config_file)
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\bu
lkloader.py", line 3873, in LoadConfig
Loader.RegisterLoader(cls())
File "SubscribLoader.py", line 23, in __init__
('description', lambda x: x.decode('utf-8')),
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\bu
lkloader.py", line 2674, in __init__
GetImplementationClass(kind)
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\bu
lkloader.py", line 968, in GetImplementationClass
implementation_class = db.class_for_kind(kind_or_class_key)
File "c:\program files (x86)\google\google_appengine\google\appengine\ext\db\_
_init__.py", line 296, in class_for_kind
raise KindError('No implementation for kind \'%s\'' % kind)
google.appengine.ext.db.KindError: No implementation for kind 'DbSubscrib
'
Here is the command Line :
appcfg.py upload_data --config_file=SubscribLoader.py --filename=Subscrib.csv --
kind=(DbProduct,DbSubscrib) --url=https://.../_ah/remote_api -A appname
Here is the Loader Class
import datetime
from google.appengine.tools import bulkloader
from Db.shop.DbSubscrib import DbSubscrib
class SubscribLoader (bulkloader.Loader):
def __init__(self):
bulkloader.Loader.__init__(self, ('DbProduct','DbSubscrib'),
[
('name', lambda x: x.decode('utf-8')),
('createDate',
lambda x: datetime.datetime.strptime(x, '%m/%d/%Y').date()),
('level', lambda x: x.decode('utf-8')),
('duration', lambda x: x.decode('utf-8')),
('service', lambda x: x.decode('utf-8')),
('description', lambda x: x.decode('utf-8')),
])
loaders = [SubscribLoader]
DbSubcrib derives from DbProduct which drives from polymodel.PolyModel
Btw, I have tried to add another extra property 'class' which is hardcoded to DbSubscrib' (also tried to add 2 properties 'DbProduct' and 'DbSubscrib', without any luck.
Any help is much appreciated. I could not find a document on goole's site that goes into any nuances around PolyModel and bulkupload.

Ok, your problem is you can't upload DbSubScrib, you need to us DbProduct. If you look at any DbSubScrib as it is stored in the Datastore it is a DbProduct class, and the subclass will have an class attribute in the datastore of storing the inheritance class names
e.g
class value: ["DbProduct", "DbSubScrib"]
Chnage your loader class to DbProduct and it will work.

After a little tinkering, found the issue in google appengine's bulkuploader : it seems there was an attempt to make bulkupload work for PolyModel but not sure why this part was not fixed (or tested). Perhaps I am missing something - in anycase it works for me with these changes... The fix is in the following line of google.appengine.tools.bulkloader.py :
class BulkTransporterApp(object):
"""Class to wrap bulk transport application functionality."""
def __init__(self,
....
....
line 3399 - old - self.kind = arg_dict['kind']
line 3399 - new - self.kind = ParseKind (arg_dict['kind'])
After this change I was able to upload.
I have fixed the Bulkuploader module and command line above for how it should be to upload a PolyModel.

Related

Problem with with setting proxy variables in .bat file (Results differing outputs in cmd and batch)

Describing the problem
I am trying to create a conda environment from .yml file in a .bat file. Since I am doing this within my company, it is needed to configure proxy. When I do it in command window, the environment is successfully created. However, when in the .bat file, an exceptions occurs and conda provides an error report to be sent.
This .bat file I am composing is very needed, so my questions are:
Are there any import differences between running this process on batch and cmd that unable me from getting this from the .bat file? What do I need to do to run this process on .bat file?
Code examples to reproduce the problem:
1. On Command Window
On cmd, if I run the following commands, I can get my result, which is creating the environment specific in the .yml file (samples only):
set https_proxy=https://username:password#proxy:port
conda env create -f environment-sample.yml
2. On .bat file
On .bat, running the file containing the following code, I get an error message, which will be presented below:
REM Using Delayed Expansion because this code will be inside an IF statement on .bat
setlocal EnableDelayedExpansion
set /p login="Login: "
set /p password="Password: "
set https_proxy=https://!login!:!password!#proxy:port
conda env create -f environment.yml
ERROR MESSAGE RETURNED:
Collecting package metadata: failed
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\requests\adapters.py", line 412, in send
conn = self.get_connection(request.url, proxies)
File "C:\Anaconda3\lib\site-packages\requests\adapters.py", line 305, in get_connection
proxy_url = parse_url(proxy)
File "C:\Anaconda3\lib\site-packages\urllib3\util\url.py", line 199, in parse_url
raise LocationParseError(url)
urllib3.exceptions.LocationParseError: Failed to parse: lnx237in.sjk.emb:9090
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\conda\exceptions.py", line 1002, in __call__
return func(*args, **kwargs)
File "C:\Anaconda3\lib\site-packages\conda_env\cli\main.py", line 73, in do_call
exit_code = getattr(module, func_name)(args, parser)
File "C:\Anaconda3\lib\site-packages\conda_env\cli\main_create.py", line 106, in execute
installer.install(prefix, pkg_specs, args, env)
File "C:\Anaconda3\lib\site-packages\conda_env\installers\conda.py", line 27, in install
unlink_link_transaction = solver.solve_for_transaction(prune=getattr(args, 'prune', False))
File "C:\Anaconda3\lib\site-packages\conda\core\solve.py", line 107, in solve_for_transaction
force_remove, force_reinstall)
File "C:\Anaconda3\lib\site-packages\conda\core\solve.py", line 145, in solve_for_diff
force_remove)
File "C:\Anaconda3\lib\site-packages\conda\core\solve.py", line 235, in solve_final_state
ssc = self._collect_all_metadata(ssc)
File "C:\Anaconda3\lib\site-packages\conda\common\io.py", line 85, in decorated
return f(*args, **kwds)
File "C:\Anaconda3\lib\site-packages\conda\core\solve.py", line 286, in _collect_all_metadata
index, r = self._prepare(prepared_specs)
File "C:\Anaconda3\lib\site-packages\conda\core\solve.py", line 678, in _prepare
self.subdirs, prepared_specs)
File "C:\Anaconda3\lib\site-packages\conda\core\index.py", line 213, in get_reduced_index
new_records = query_all(spec)
File "C:\Anaconda3\lib\site-packages\conda\core\index.py", line 176, in query_all
return tuple(concat(future.result() for future in as_completed(futures)))
File "C:\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 93, in query
self.load()
File "C:\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 147, in load
_internal_state = self._load()
File "C:\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 218, in _load
mod_etag_headers.get('_mod'))
File "C:\Anaconda3\lib\site-packages\conda\core\subdir_data.py", line 429, in fetch_repodata_remote_request
timeout=timeout)
File "C:\Anaconda3\lib\site-packages\requests\sessions.py", line 546, in get
return self.request('GET', url, **kwargs)
File "C:\Anaconda3\lib\site-packages\requests\sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:\Anaconda3\lib\site-packages\requests\sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:\Anaconda3\lib\site-packages\requests\adapters.py", line 414, in send
raise InvalidURL(e, request=request)
requests.exceptions.InvalidURL: Failed to parse: lnx237in.sjk.emb:9090
`$ C:\Anaconda3\Scripts\conda-env-script.py create -f environment.yml`
environment variables:
CIO_TEST=<not set>
CLASSPATH=C:\Program Files\Java\jdk1.8.0_51\lib\tools.jar
CONDA_AUTO_UPDATE_CONDA=false
CONDA_EXE=C:\Anaconda3\Scripts\conda.exe
CONDA_ROOT=C:\Anaconda3
CONDA_SHLVL=0
HOMEPATH=\Users\MFINACI
HTTPS_PROXY=<set>
MIC_LD_LIBRARY_PATH=C:\Program Files (x86)\Common Files\Intel\Shared
Libraries\compiler\lib\mic
PATH=C:\Anaconda3\;C:\Anaconda3\Library\mingw-w64\bin;C:\Anaconda3\Library\
usr\bin;C:\Anaconda3\Library\bin;C:\Anaconda3\Scripts;C:\Anaconda3\bin
;C:\Anaconda3\condabin;C:\Anaconda3;C:\Anaconda3\Library\mingw-w64\bin
;C:\Anaconda3\Library\usr\bin;C:\Anaconda3\Library\bin;C:\Anaconda3\Sc
ripts;C:\ProgramData\Oracle\Java\javapath;C:\Program Files
(x86)\VNI\imsl\fnl710\winin140x64\lib;C:\Program Files (x86)\Common
Files\Microsoft Shared\VSA\10.0\VsaEnv;C:\Program Files (x86)\Common
Files\Intel\Shared Libraries\redist\intel64\mpirt;C:\Program Files
(x86)\Common Files\Intel\Shared
Libraries\redist\intel64\compiler;C:\Program Files (x86)\Common
Files\Intel\Shared Libraries\redist\ia32\mpirt;C:\Program Files
(x86)\Common Files\Intel\Shared Libraries\redist\ia32\compiler;C:\Orac
le\product\11.2.0\client_32\bin;C:\Oracle\product\11.2.0\client_64\bin
;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS
Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Win
dows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R)
Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R)
Management Engine Components\DAL;C:\Program Files\Intel\Intel(R)
Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R)
Management Engine Components\IPT;c:\Program Files (x86)\Microsoft SQL
Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL
Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL
Server\100\DTS\Binn\;C:\Program Files\Microsoft Windows Performance
Toolkit\;C:\Program Files\Java\jdk1.8.0_51\bin;C:\Program Files\Tortoi
seSVN\bin;C:\Users\MFINACI\AppData\Local\Programs\Microsoft VS
Code\bin;C:\Users\MFINACI\AppData\Local\Programs\Git\cmd
PSMODULEPATH=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
PYTHONIOENCODING=1252
REQUESTS_CA_BUNDLE=<not set>
SSF_LIBRARY_PATH=C:\Program Files (x86)\SAP\FrontEnd\SecureLogin\lib\sapcrypto.dll
SSL_CERT_FILE=<not set>
active environment : None
shell level : 0
user config file : C:\Users\MFINACI\.condarc
populated config files : C:\Users\MFINACI\.condarc
conda version : 4.6.7
conda-build version : 3.10.5
python version : 3.7.2.final.0
base environment : C:\Anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/win-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\Anaconda3\pkgs
C:\Users\MFINACI\.conda\pkgs
C:\Users\MFINACI\AppData\Local\conda\conda\pkgs
envs directories : C:\Anaconda3\envs
C:\Users\MFINACI\.conda\envs
C:\Users\MFINACI\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/4.6.7 requests/2.21.0 CPython/3.7.2 Windows/7 Windows/6.1.7601
administrator : False
netrc file : None
offline mode : False
An unexpected error has occurred. Conda has prepared the above report.
If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers?
[y/N]:
Attempts to understand the problem
I checked if the variables are being correctly assigned and they are. I did that basically "echoing" the variables. The screen result I got commenting the first line of the code (REM #echo off) are (Changing full path to make it cleaner):
C:\Users\MFINACI>set /p login="Login: "
Login: userexample
C:\Users\MFINACI>echo !login!
userexample
C:\Users\MFINACI>set /p password="Password: "
Password: passwordexample
C:\Users\MFINACI>echo !password!
passwordexample
C:\Users\MFINACI>set https_proxy=https://!login!:!password!#lnx237in.sjk.emb:9090
C:\Users\MFINACI>echo !https_proxy!
https://userexample:passwordexample#lnx237in.sjk.emb:9090
Also tried to find similar problems at the community, however, none of them present the problem of getting the results successfully on cmd and not on .bat file. Could you please help me?
This is my first question here, I really tried not to ask a duplicate and respect the rules of the community. Sorry if I made
anything wrong.

How to connect Django project with MS SQL server?

I am beginner in Django framework and trying to connect Django project with MS sQL server on my localhost. I have tried a few of libs like pyodbc-azure but it is not working in my case and I am getting the errors.
"C:\Program Files\JetBrains\PyCharm 2018.1.5\bin\runnerw.exe"
"C:\Program Files (x86)\Python37-32\python.exe"
C:/Users/hyaqub/PycharmProjects/SpotDash/manage.py runserver 8000
Unhandled exception in thread started by .wrapper at 0x04A1BD68> Traceback (most recent
call last): File "C:\Program Files
(x86)\Python37-32\lib\site-packages\django_pyodbc\base.py", line 55,
in import pyodbc as Database ImportError: DLL load failed:
The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Program Files
(x86)\Python37-32\lib\site-packages\django\utils\autoreload.py", line
225, in wrapper fn(*args, **kwargs) File "C:\Program Files
(x86)\Python37-32\lib\site-packages\django\core\management\commands\runserver.py",
line 109, in inner_run autoreload.raise_last_exception() File
"C:\Program Files
(x86)\Python37-32\lib\site-packages\django\utils\autoreload.py", line
248, in raise_last_exception raise _exception[1] File "C:\Program
Files
(x86)\Python37-32\lib\site-packages\django\core\management__init__.py",
line 337, in execute autoreload.check_errors(django.setup)() File
"C:\Program Files
(x86)\Python37-32\lib\site-packages\django\utils\autoreload.py", line
225, in wrapper fn(*args, **kwargs) File "C:\Program Files
(x86)\Python37-32\lib\site-packages\django__init__.py", line 24, in
setup apps.populate(settings.INSTALLED_APPS) File "C:\Program Files
(x86)\Python37-32\lib\site-packages\django\apps\registry.py", line
112, in populate app_config.import_models() File "C:\Program Files
(x86)\Python37-32\lib\site-packages\django\apps\config.py", line 198,
in import_models self.models_module =
import_module(models_module_name) File "C:\Program Files
(x86)\Python37-32\lib\importlib__init__.py", line 127, in
import_module return _bootstrap._gcd_import(name[level:], package,
level) File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load File
"", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked File
"", line 728, in exec_module
File "", line 219, in
_call_with_frames_removed File "C:\Program Files (x86)\Python37-32\lib\site-packages\django\contrib\auth\models.py",
line 2, in from django.contrib.auth.base_user import
AbstractBaseUser, BaseUserManager File "C:\Program Files
(x86)\Python37-32\lib\site-packages\django\contrib\auth\base_user.py",
line 47, in class AbstractBaseUser(models.Model): File
"C:\Program Files
(x86)\Python37-32\lib\site-packages\django\db\models\base.py", line
101, in new new_class.add_to_class('_meta', Options(meta,
app_label)) File "C:\Program Files
(x86)\Python37-32\lib\site-packages\django\db\models\base.py", line
305, in add_to_class value.contribute_to_class(cls, name) File
"C:\Program Files
(x86)\Python37-32\lib\site-packages\django\db\models\options.py", line
203, in contribute_to_class self.db_table =
truncate_name(self.db_table, connection.ops.max_name_length()) File
"C:\Program Files
(x86)\Python37-32\lib\site-packages\django\db__init__.py", line 33,
in getattr return getattr(connections[DEFAULT_DB_ALIAS], item) File
"C:\Program Files
(x86)\Python37-32\lib\site-packages\django\db\utils.py", line 202, in
getitem backend = load_backend(db['ENGINE']) File "C:\Program Files (x86)\Python37-32\lib\site-packages\django\db\utils.py", line 110, in
load_backend return import_module('%s.base' % backend_name) File
"C:\Program Files (x86)\Python37-32\lib\importlib__init__.py", line
127, in import_module return _bootstrap._gcd_import(name[level:],
package, level) File "C:\Program Files
(x86)\Python37-32\lib\site-packages\django_pyodbc\base.py", line 58,
in raise ImproperlyConfigured("Error loading pyodbc module:
%s" % e) django.core.exceptions.ImproperlyConfigured: Error loading
pyodbc module: DLL load failed: The specified module could not be
found.
Please guide me how can I achieve this. It would be appreciated.
The error states that you are missing a DLL/module. I am not sure what process you went to install, but these instructions state that you need Install the Microsoft ODBC Driver for SQL Server on Windows, which should include all of the necessary DLL's

Error while uploading csv to Google App Engine

I am trying to upload a csv file to GAE but having errors.
I am following this blog post and using same yml file. I can download data but upload command is giving following errors:
C:\Users\ADMIN>appcfg.py upload_data --config_file=C:\bulk\config.yml --file
name=C:\bulk\data.csv --url=http://encryptedsearch.appspot.com/remote_api --appl
ication=encryptedsearch --kind=Greeting
06:44 PM Uploading data records.
[INFO ] Logging to bulkloader-log-20151206.184424
[INFO ] Throttling transfers:
[INFO ] Bandwidth: 250000 bytes/second
[INFO ] HTTP connections: 8/second
[INFO ] Entities inserted/fetched/modified: 20/second
[INFO ] Batch Size: 10
[INFO ] Opening database: bulkloader-progress-20151206.184424.sql3
2015-12-06 18:44:24,763 INFO client.py:669 access_token is expired. Now: 2015-12
-06 13:44:24.763000, token_expiry: 2015-12-05 20:24:05
2015-12-06 18:44:25,891 INFO client.py:669 access_token is expired. Now: 2015-12
-06 13:44:25.891000, token_expiry: 2015-12-05 20:24:05
2015-12-06 18:44:26,576 INFO client.py:669 access_token is expired. Now: 2015-12
-06 13:44:26.577000, token_expiry: 2015-12-05 20:24:05
2015-12-06 18:44:27,687 INFO client.py:669 access_token is expired. Now: 2015-12
-06 13:44:27.687000, token_expiry: 2015-12-05 20:24:05
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 133, in
<module>
run_file(__file__, globals())
File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 129, in
run_file
execfile(_PATHS.script_file(script_name), globals_)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 5469, in <module>
main(sys.argv)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 5460, in main
result = AppCfgApp(argv).Run()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 3010, in Run
self.action(self)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 5116, in __call__
return method()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 4919, in PerformUpload
run_fn(args)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\ap
pcfg.py", line 4803, in RunBulkloader
sys.exit(bulkloader.Run(arg_dict, self._GetOAuth2Parameters()))
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\bu
lkloader.py", line 4349, in Run
return _PerformBulkload(arg_dict, oauth2_parameters)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\bu
lkloader.py", line 4211, in _PerformBulkload
loader.finalize()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\bulk
load\bulkloader_config.py", line 383, in finalize
self.reserve_keys(self.keys_to_reserve)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\bu
lkloader.py", line 1211, in ReserveKeys
datastore._GetConnection()._reserve_keys(ConvertKeys(keys))
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\datastor
e\datastore_rpc.py", line 2172, in _reserve_keys
self._async_reserve_keys(None, keys).get_result()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\datastor
e\datastore_rpc.py", line 2210, in _async_reserve_keys
service_name=_DATASTORE_V4))
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\datastor
e\datastore_rpc.py", line 1341, in _make_rpc_call
rpc = self._create_rpc(config, service_name)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\datastor
e\datastore_rpc.py", line 1236, in _create_rpc
rpc = apiproxy_stub_map.UserRPC(service_name, deadline, callback)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apip
roxy_stub_map.py", line 414, in __init__
self.__rpc = CreateRPC(service, stubmap)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\api\apip
roxy_stub_map.py", line 68, in CreateRPC
assert stub, 'No api proxy found for service "%s"' % service
AssertionError: No api proxy found for service "datastore_v4"
I am uploading same file back to datastore which I downloaded with command:
appcfg.py download_data --config_file=C:\bulk\config.yml --filename=C:\bulk\data.csv --kind=Greeting --url=http://encryptedsearch.appspot.com/remote_api --application=encryptedsearch
My config.yml is below:
# Autogenerated bulkloader.yaml file.
# You must edit this file before using it. TODO: Remove this line when done.
# At a minimum address the items marked with TODO:
# * Fill in connector and connector_options
# * Review the property_map.
# - Ensure the 'external_name' matches the name of your CSV column,
# XML tag, etc.
# - Check that __key__ property is what you want. Its value will become
# the key name on import, and on export the value will be the Key
# object. If you would like automatic key generation on import and
# omitting the key on export, you can remove the entire __key__
# property from the property map.
# If you have module(s) with your model classes, add them here. Also
# change the kind properties to model_class.
python_preamble:
- import: base64
- import: re
- import: google.appengine.ext.bulkload.transform
- import: google.appengine.ext.bulkload.bulkloader_wizard
- import: google.appengine.api.datastore
- import: google.appengine.api.users
transformers:
- kind: Greeting
connector: csv
connector_options:
# TODO: Add connector options here--these are specific to each connector.
property_map:
- property: __key__
external_name: key
import_transform: transform.key_id_or_name_as_string
- property: content
external_name: content
# Type: String Stats: 7 properties of this type in this kind.
- property: date
external_name: date
# Type: Date/Time Stats: 7 properties of this type in this kind.
import_transform: transform.import_date_time('%Y-%m-%dT%H:%M:%S')
export_transform: transform.export_date_time('%Y-%m-%dT%H:%M:%S')
- property: name
external_name: name
# Type: String Stats: 7 properties of this type in this kind.
CSV file contents:
content,date,name,key
Hi,2015-12-05T17:24:14,,ahFzfmVuY3J5cHRlZHNlYXJjaHIrCxIJR3Vlc3Rib29rIgdkZWZhdWx0DAsSCEdyZWV0aW5nGICAgICAgIAKDA
3rd,2015-12-05T17:30:04,,ahFzfmVuY3J5cHRlZHNlYXJjaHIrCxIJR3Vlc3Rib29rIgdkZWZhdWx0DAsSCEdyZWV0aW5nGICAgICA8ogKDA
2nd,2015-12-05T17:25:59,,ahFzfmVuY3J5cHRlZHNlYXJjaHIrCxIJR3Vlc3Rib29rIgdkZWZhdWx0DAsSCEdyZWV0aW5nGICAgICA5JEKDA
Datastore entries:
link to image
For all others that are fighting with the same issue. I found that there was no other solution for me than commenting that line in actual client.py.
Solution:
locate the client.py file ( ../google-cloud-sdk/platform/google_cloud/lib/oauth2client/oauth2client/client.py in my case)
navigate to access_token_expired() method
comment following code:
if now >= self.token_expiry:
logger.info('access_token is expired. Now: %s, token_expiry: %s',
now, self.token_expiry)
return True

Why does this gsutil call not work from FinalBuilder website but works when run in FinalBuilder application?

I have a .bat file that makes the following gsutil call to push a file to the Google Cloud:
python "C:\Program Files (x86)\gsutil\gsutil" -D -m cp -a public-read C:\Temp\MyMSI.msi gs://downloads-gs.mywebsite.com/binaries/myapplication/auto_installer/
Here is my output(with a few names changed for obscurity):
----------------------------------------------------------
Copy to google 11:02:33 AM 11:02:34 AM 00:00:00:479 Failed (Ignored)
Collapse Messages
Messages
Collapse
Executing external process: C:\Windows\system32\cmd.exe
Starting Directory: C:\BuildScripts
Parameters: /c "c:\buildscripts\push_goog.bat"
Collapse
Output from C:\Windows\system32\cmd.exe
The system cannot find the drive specified.
C:\BuildScripts>pushd c:\BuildScripts\
The system cannot find the drive specified.
Traceback (most recent call last):
File "C:\Program Files (x86)\gsutil\gsutil", line 67, in <module>
from gslib.util import UsingCrcmodExtension
File "C:\Program Files (x86)\gsutil\gslib\util.py", line 121, in <module>
os.path.join(CreateTrackerDirIfNeeded(), '.last_software_update_check'))
File "C:\Program Files (x86)\gsutil\gslib\util.py", line 108, in CreateTrackerDirIfNeeded
os.makedirs(tracker_dir)
File "C:\Python27\lib\os.py", line 150, in makedirs
makedirs(head, mode)
**C:\BuildScripts>python "C:\Program Files (x86)\gsutil\gsutil" -D -m cp -a public-read C:\Temp\MyMSI.msi gs://downloads-gs.mywebsite.com/binaries/myapplication/auto_installer/**
File "C:\Python27\lib\os.py", line 157, in makedirs
mkdir(name, mode)
WindowsError: [Error 3] The system cannot find the path specified: 'H:\\\\'
Program returned code : 1
It is mentioning something about H:\\\\ which we don't use and never mentioned in the .bat file or in the params to gsutil. I'm not sure why it works perfectly when run from the FinalBuilder application and then it gets this error when the FinalBuilder website runs the same FinalBuilder application file but is just triggered through the FinalBuilder Server.
Any help would be great.
The root cause for this is that your home directory is set to an invalid location.
As a workaround, you can change the tracker directory in your .boto configuration file. Here's the relevant section:
[GSUtil]
# 'resumable_tracker_dir' specifies the base location where resumable
# transfer tracker files are saved. By default they're in ~/.gsutil
#resumable_tracker_dir = <file path>
Uncomment the resumable_tracker_dir variable and set it to a location on disk that does exist.

Certificate not work when i try to update

Good day to all. I am using Google App Engine 1.6.2 , Python 2.7 ,Windows 7x64, i created an application..uploded it...it was successfully working for about a weak. But when i was trying to make an update this morning, luncher gave me this error:
2012-02-20 12:26:41 Running command: "['C:\\Python27\\pythonw.exe', '-u', 'C:\\Program Files (x86)\\Google\\google_appengine\\appcfg.py', '--no_cookies', u'--email=myemail#gmail.com', '--passin', 'update', 'D:\\Dropbox\\Google\\handmade']"
Application: bubonchikhub; version: 1
Host: appengine.google.com
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 101, in <module>
run_file(__file__, globals())
File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 97, in run_file
execfile(script_path, globals_)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 3935, in <module>
main(sys.argv)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 3926, in main
result = AppCfgApp(argv).Run()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 2497, in Run
self.action(self)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 3692, in __call__
return method()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 2915, in Update
self.UpdateVersion(rpcserver, self.basepath, appyaml)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 2897, in UpdateVersion
updatecheck.CheckForUpdates()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 572, in CheckForUpdates
runtime=self.config.runtime)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appengine_rpc.py", line 365, in Send
f = self.opener.open(req)
File "C:\Python27\lib\urllib2.py", line 394, in open
response = self._open(req, data)
File "C:\Python27\lib\urllib2.py", line 412, in _open
'_open', req)
File "C:\Python27\lib\urllib2.py", line 372, in _call_chain
result = func(*args)
File "C:\Python27\lib\urllib2.py", line 1207, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "C:\Program Files (x86)\Google\google_appengine\lib\fancy_urllib\fancy_urllib\__init__.py", line 363, in do_open
url_error.reason.args[1])
fancy_urllib.InvalidCertificateException: Host 127.0.0.1:8888 returned an invalid certificate (_ssl.c:503: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed):
To learn more, see http://code.google.com/appengine/kb/general.html#rpcssl
2012-02-20 12:26:43 (Process exited with code 1)
You can close this window now.
You can close this window now.
Can anyone help how to fix this?
Thnx in advance
Your request might be going through a local proxy.
Upgrading to Python 2.7.9 fixed this for me.
You need to paste your proxy's certification to the end of google_appengine/lib/cacerts/cacerts.txt
This does seem to be related to proxy servers, when I run fiddler and try to deploy I get this error. When I shut it down deployment works fine.
You will get an invalid certificate error like
fancy_urllib.InvalidCertificateException: Host 127.0.0.1:8888 returned an invalid certificate (_ssl.c:507: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed):
So turn of the proxy server (assuming this is your issue) you are running and and the run the appcfg deploy!

Resources