allow tables with no primary keys

This commit is contained in:
mdipierro
2013-05-15 11:20:30 -05:00
parent e64c556f84
commit 0b84911d38
2 changed files with 5 additions and 4 deletions
+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),
on_delete_action = field.ondelete)
if hasattr(table,'_primarykey'):
if getattr(table,'_primarykey',None):
query = "CREATE TABLE %s(\n %s,\n %s) %s" % \
(tablename, fields,
self.PRIMARY_KEY(', '.join(table._primarykey)),other)
@@ -1775,7 +1775,7 @@ class BaseAdapter(ConnectionPool):
LOGGER.debug('SQL: %s' % command)
self.db._lastsql = command
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))
del self.db._timings[:-TIMINGSSIZE]
return ret
@@ -1856,7 +1856,7 @@ class BaseAdapter(ConnectionPool):
if have_serializers:
obj = serializers.json(obj)
elif simplejson:
obj = simplejson.dumps(obj)
obj = simplejson.dumps(items)
else:
raise RuntimeError("missing simplejson")
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',
}
def EXTRACT(self, first, what):
return "DATE_PART('%s', TIMESTAMP %s)" % (what, self.expand(first))