所以,我有一个数据库,我已经以多种方式导入Postgresql,直接使用命令行或pgadmin3,但所有尝试都给我同样的问题:使用简单脚本时我无法查询任何内容比如
class BaseClass(object):
def __init__(self, base_arg, base_arg2=None, *args, **kwargs):
print "\tBaseClass: {}, {}".format(base_arg, base_arg2)
try:
super(BaseClass, self).__init__(*args, base_arg=base_arg, base_arg2=base_arg2, **kwargs)
except:
super(BaseClass, self).__init__()
class MixinClass(object):
def __init__(self, mixin_arg, *args, **kwargs):
print "\tMixinClass: {}".format(mixin_arg)
try:
super(MixinClass, self).__init__(*args, mixin_arg=mixin_arg, **kwargs)
except:
super(MixinClass, self).__init__()
class MixinClassB(object):
def __init__(self, mixin_arg, *args, **kwargs):
print "\tMixinClassB: {}".format(mixin_arg)
try:
super(MixinClassB, self).__init__(*args, mixin_arg=mixin_arg, **kwargs)
except:
super(MixinClassB, self).__init__()
class ChildClassA(BaseClass, MixinClass):
"""
Let's make it work for this case
"""
def __init__(self, base_arg, mixin_arg, base_arg2=None):
print "Initializing {}: base_arg: {} mixin_arg: {} base_arg2: {}".format(
self.__class__.__name__, base_arg, mixin_arg, base_arg2)
super(ChildClassA, self).__init__(base_arg=base_arg, mixin_arg=mixin_arg, base_arg2=base_arg2)
class ChildClassC(BaseClass, MixinClassB, MixinClass):
"""
Now let's simply add another mixin: before...
"""
def __init__(self, base_arg, mixin_arg, base_arg2=None):
print "Initializing {}: base_arg: {} mixin_arg: {} base_arg2: {}".format(
self.__class__.__name__, base_arg, mixin_arg, base_arg2)
super(ChildClassC, self).__init__(base_arg=base_arg, mixin_arg=mixin_arg, base_arg2=base_arg2)
class ChildClassD(BaseClass, MixinClass, MixinClassB):
"""
Now let's simply add another mixin: ..and after
"""
def __init__(self, base_arg, mixin_arg, base_arg2=None):
print "Initializing {}: base_arg: {} mixin_arg: {} base_arg2: {}".format(
self.__class__.__name__, base_arg, mixin_arg, base_arg2)
super(ChildClassD, self).__init__(base_arg=base_arg, mixin_arg=mixin_arg, base_arg2=base_arg2)
try:
base = BaseClass(1, 2)
except Exception as e:
print "Failed because object.__init__ does not expect any argument ({})".format(e)
childA = ChildClassA(1, 3, 2) # note the order of the arguments - the mixin arg is interleaved
childC = ChildClassC(1, 3, 2)
childD = ChildClassD(1, 3, 2)
因为我遇到“关系不存在”。
我已经搜索过高低,我发现错误是由使用大写字母等的数据库名称冲突引起的,但你可以看到我不应该有这个问题,因为我没有使用过小写字母。
所以我完全迷失了该怎么做。是的,我真的还在学习postgresql中的绳索,所以如果它只是一个非常基本的东西,就像我错过了一个选项,请原谅我!这个image显示了我得到的错误以及您可能需要的更多信息。
我正在使用虚拟机
- VMware Workstation
- Ubuntu 15.04
- Postgresql 9.4
- pgAdmin3 v1.20
提前致谢!