Importing CTFd-exported ZIP gives DateTime errorSee original GitHub issue
- CTFd Version/Commit: master
- Operating System: Debian Testing
- Web Browser and Version: N/A
What happened? In trying to import a ZIP file that was previously exported with CTFd, an error is thrown stating “SQLite DateTime type only accepts Python”
What did you expect to happen? I expected the data to import successfully
How to reproduce your issue sudo python import.py ~/CTF-DATA.zip
Any associated stack traces or error logs
> sudo python import.py ~/CTF-DATA.zip /*\ CTFd has updated and must update the database! /*\ /*\ Please backup your database before proceeding! /*\ /*\ CTFd maintainers are not responsible for any data loss! /*\ Run database migrations (Y/N)y * Loaded module, <module 'CTFd.plugins.challenges' from '/var/www/ctfd/CTFd/plugins/challenges/__init__.pyc'> * Loaded module, <module 'CTFd.plugins.keys' from '/var/www/ctfd/CTFd/plugins/keys/__init__.pyc'> Traceback (most recent call last): File "import.py", line 9, in <module> import_ctf(sys.argv) File "/var/www/ctfd/CTFd/utils.py", line 802, in import_ctf table.insert(entry) File "/usr/local/lib/python2.7/dist-packages/dataset/table.py", line 80, in insert res = self.db.executable.execute(self.table.insert(row)) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 945, in execute return meth(self, multiparams, params) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement compiled_sql, distilled_params File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1121, in _execute_context None, None) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception exc_info File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1116, in _execute_context context = constructor(dialect, self, conn, *args) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 623, in _init_compiled param.append(processors[key](compiled_params[key])) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/dialects/sqlite/base.py", line 610, in process raise TypeError("SQLite DateTime type only accepts Python " sqlalchemy.exc.StatementError: (exceptions.TypeError) SQLite DateTime type only accepts Python datetime and date objects as input. [SQL: u'INSERT INTO teams (name, email, password, website, affiliation, country, bracket, banned, verified, admin, joined) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)']
- Created 6 years ago
- Comments:12 (7 by maintainers)
Top GitHub Comments
CTFd exports should be able to go between databases. They should be viewed as a single portable file that can go between CTFd instances.
I think there’s enough here to warrant some kind of fix so I’ll try to reproduce and come up with some general solution.
In that case I would probably see if you can modify the date format, or downgrade to 1.0.2, import, and then upgrade CTFd to master and run migrations.