allow tables with no primary keys

This commit is contained in:
mdipierro committed 2013-05-15 11:20:30 -05:00
1 parent e64c556f84
commit 0b84911d38
2 files changed
+5 -4

No files matched your search

+1 -1
View File
@@ -1 +1 @@
Version 2.4.6-stable+timestamp.2013.05.14.00.28.50 Version 2.4.6-stable+timestamp.2013.05.15.11.18.49
+4 -3
View File
@@ -928,7 +928,7 @@ class BaseAdapter(ConnectionPool):
foreign_key = ', '.join(pkeys), foreign_key = ', '.join(pkeys),
on_delete_action = field.ondelete) on_delete_action = field.ondelete)
if hasattr(table,'_primarykey'): if getattr(table,'_primarykey',None):
query = "CREATE TABLE %s(\n %s,\n %s) %s" % \ query = "CREATE TABLE %s(\n %s,\n %s) %s" % \
(tablename, fields, (tablename, fields,
self.PRIMARY_KEY(', '.join(table._primarykey)),other) self.PRIMARY_KEY(', '.join(table._primarykey)),other)
@@ -1775,7 +1775,7 @@ class BaseAdapter(ConnectionPool):
LOGGER.debug('SQL: %s' % command) LOGGER.debug('SQL: %s' % command)
self.db._lastsql = command self.db._lastsql = command
t0 = time.time() t0 = time.time()
ret = self.cursor.execute(command,*a[1:], **b) ret = self.cursor.execute(command, *a[1:], **b)
self.db._timings.append((command,time.time()-t0)) self.db._timings.append((command,time.time()-t0))
del self.db._timings[:-TIMINGSSIZE] del self.db._timings[:-TIMINGSSIZE]
return ret return ret
@@ -1856,7 +1856,7 @@ class BaseAdapter(ConnectionPool):
if have_serializers: if have_serializers:
obj = serializers.json(obj) obj = serializers.json(obj)
elif simplejson: elif simplejson:
obj = simplejson.dumps(obj) obj = simplejson.dumps(items)
else: else:
raise RuntimeError("missing simplejson") raise RuntimeError("missing simplejson")
if not isinstance(obj,bytes): if not isinstance(obj,bytes):
@@ -3366,6 +3366,7 @@ class VerticaAdapter(MSSQLAdapter):
'big-reference': 'BIGINT REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s', 'big-reference': 'BIGINT REFERENCES %(foreign_key)s ON DELETE %(on_delete_action)s',
} }
def EXTRACT(self, first, what): def EXTRACT(self, first, what):
return "DATE_PART('%s', TIMESTAMP %s)" % (what, self.expand(first)) return "DATE_PART('%s', TIMESTAMP %s)" % (what, self.expand(first))