• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python psycopg.connect函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中psycopg.connect函数的典型用法代码示例。如果您正苦于以下问题:Python connect函数的具体用法?Python connect怎么用?Python connect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了connect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: abre_coneccion

 def abre_coneccion(self):
     try:
         f = open("coneccion.rc", 'r')
         l = f.readline()[:-1]
         self.cnx = connect(l)
         f.close()
         print "Conección por archivo"
     except:
         DB = config.DB
         user = config.user
         password = config.password
         host = config.host
 
         self.cnx = connect(DB + " " + user + " " + password + " " + host )
         print "Conección base"
开发者ID:esanmartin,项目名称:agro,代码行数:15,代码来源:wnAgro.py


示例2: __init__

	def __init__(self, hostname, dbname, schema, source_table, target_table, offset, limit, \
		output, bonferroni=0, report=0, log=0, wu=0, needcommit=0):
		self.conn = psycopg.connect('host=%s dbname=%s'%(hostname, dbname))
		self.curs = self.conn.cursor()
		self.curs.execute("set search_path to %s"%schema)
		self.source_table = source_table
		self.target_table = target_table
		self.offset = offset
		self.limit = limit
		self.output = output
		if self.output:
			#filename exists
			self.outf = open(self.output, 'w')

		self.bonferroni = int(bonferroni)
		self.report = int(report)
		self.log = int(log)
		self.wu = int(wu)
		self.needcommit = int(needcommit)
		self.global_go_id_to_no_dict = {}
		self.global_go_no_to_size_dict = {}
		self.global_gene_to_go_dict = {}
		self.no_of_records = 0
		if self.log:
			self.logfile = open('/tmp/cluster_stat.log','w')
		self.cluster_memory = {}
开发者ID:polyactis,项目名称:annot,代码行数:26,代码来源:cluster_stat.py


示例3: __init__

	def __init__(self, hostname, dbname, schema, table, branch, depth, all, new_table, report=0, \
		needcommit=0, log=0):
		self.conn = psycopg.connect('host=%s dbname=%s'%(hostname, dbname))
		self.curs = self.conn.cursor()
		self.curs.execute("set search_path to %s"%schema)
		self.table = table
		
		self.depth = int(depth)
		self.all = int(all)
		self.new_table = int(new_table)
		self.report = int(report)
		self.needcommit = int(needcommit)
		self.log = int(log)
		
		#mapping for the branches
		self.branch_dict = {0:'molecular_function',
			1:'biological_process',
			2:'cellular_component'}
		self.branch = self.branch_dict[int(branch)]
		if self.log:
			self.log_file = open('/tmp/go_node_distance.log','w')
		#mapping between go term id and its index list
		self.go_id2index = {}
		#mapping between go_id and go_acc
		self.go_id2acc = {}
		#GO DAG (directed)
		self.go_digraph = Graph.Graph()
		#GO undirected Graph, to compute distance between two nodes
		self.go_graph = Graph.Graph()
		#the node_list contains the nodes to compute pairwise distances
		self.node_list = Set()
		#the list containing all indices
		self.index_list = Set()
		#key structure, mapping between a pair of go_id's and its associated distances
		self.go_id2distance = {}
开发者ID:polyactis,项目名称:annot,代码行数:35,代码来源:go_node_distance.py


示例4: __init__

	def __init__(self, hostname, dbname, schema, source_table, target_table, prune_type, threshhold, report, log=0, needcommit=0):
		self.conn = psycopg.connect('host=%s dbname=%s'%(hostname, dbname))
		self.curs = self.conn.cursor()
		self.curs.execute("set search_path to %s"%schema)
		self.source_table = source_table
		self.target_table = target_table
		self.prune_type = int(prune_type)
		self.threshhold = float(threshhold)
		self.report = int(report)
		self.log = int(log)
		self.needcommit = int(needcommit)
		self.prune_func_dict = {0:self.prune_on_edge_set,
			1:self.prune_on_recurrence_array,
			2:self.prune_on_vertex_set}
		#a function mapping structure.
		self.vertex_set_dict = {}
		#store a edge_set_dict or recurrence_pattern_dict with the same vertex_set
		self.mcl_id2connectivity_dict ={}
		#store the mcl_id:connectivity pair
		self.good_mcl_id_dict = {}
		#the mcl_id:recurrence_array pair dictionary
		self.bad_mcl_id_list = []
		#store the mcl_ids that are going to be deleted.
		if self.log:
			self.log_file = open("/tmp/cluster_prune.log", 'w')
		self.no_of_goods = 0
		self.no_of_bads = 0
		self.run_no = 0
		self.remaining = 1	#1 is useful to let the first run start
		#two tables for bucketing
		self.src_table = 'src_tmp'
		self.tg_table = 'tg_tmp'
开发者ID:polyactis,项目名称:annot,代码行数:32,代码来源:cluster_prune.py


示例5: __init__

	def __init__(self, dir, hostname, dbname, schema, orgn, union=0, needcommit=0):
		self.dir = dir
		self.conn = psycopg.connect('host=%s dbname=%s'%(hostname, dbname))
		self.curs = self.conn.cursor()
		self.curs.execute("set search_path to %s"%schema)
		self.union = int(union)
		self.needcommit = int(needcommit)
		self.org_short2long = {'at':'Arabidopsis thaliana',
			'ce':'Caenorhabditis elegans',
			'dm':'Drosophila melanogaster',
			'hs':'Homo sapiens',
			'mm':'Mus musculus',
			'sc':'Saccharomyces cerevisiae',
			'Arabidopsis thaliana':'Arabidopsis thaliana',
			'Caenorhabditis elegans':'Caenorhabditis elegans',
			'Drosophila melanogaster':'Drosophila melanogaster',
			'Homo sapiens':'Homo sapiens',
			'Mus musculus':'Mus musculus',
			'Gorilla gorilla Pan paniscus Homo sapiens':'Homo sapiens',
			'Saccharomyces cerevisiae':'Saccharomyces cerevisiae'}
		self.organism = self.org_short2long[orgn]
		#mapping between gene_id and gene_no
		self.gene_id2gene_no = {}
		#mapping between gene_id and its occurence
		self.gene_id2freq = {}
		#unique gene collection, for database submission
		self.gene_set = Set()
开发者ID:polyactis,项目名称:annot,代码行数:27,代码来源:gene_table.py


示例6: __init__

    def __init__(self, hostname, dbname, schema, type, output, orgn="sc"):
        self.conn = psycopg.connect("host=%s dbname=%s" % (hostname, dbname))
        self.curs = self.conn.cursor()
        self.curs.execute("set search_path to %s" % schema)

        self.type_dict = {0: "molecular_function", 1: "biological_process", 2: "cellular_component"}
        self.type = self.type_dict[int(type)]
        self.ofname = output
        self.org_short2long = {
            "at": "Arabidopsis thaliana",
            "ce": "Caenorhabditis elegans",
            "dm": "Drosophila melanogaster",
            "hs": "Homo sapiens",
            "mm": "Mus musculus",
            "sc": "Saccharomyces cerevisiae",
            "Arabidopsis thaliana": "Arabidopsis thaliana",
            "Caenorhabditis elegans": "Caenorhabditis elegans",
            "Drosophila melanogaster": "Drosophila melanogaster",
            "Homo sapiens": "Homo sapiens",
            "Mus musculus": "Mus musculus",
            "Gorilla gorilla Pan paniscus Homo sapiens": "Homo sapiens",
            "Saccharomyces cerevisiae": "Saccharomyces cerevisiae",
        }
        self.organism = self.org_short2long[orgn]
        self.log_file = open("/tmp/GO_graphxml.log", "w")
        self.termid_dict = {}
        self.acc2id_dict = {}
        self.go_graph = Graph.Graph()
开发者ID:polyactis,项目名称:annot,代码行数:28,代码来源:GO_graphxml.py


示例7: load

    def load(self):
        '''Load state from database'''

        import psycopg
        
        if options["globals", "verbose"]:
            print >> sys.stderr, 'Loading state from',self.db_name,'database'

        self.db = psycopg.connect(self.db_name)

        c = self.cursor()
        try:
            c.execute("select count(*) from bayes")
        except psycopg.ProgrammingError:
            self.db.rollback()
            self.create_bayes()
        
        if self._has_key(self.statekey):
            row = self._get_row(self.statekey)
            self.nspam = row["nspam"]
            self.nham = row["nham"]
            if options["globals", "verbose"]:
                print >> sys.stderr, ('%s is an existing database,'
                                      ' with %d spam and %d ham') \
                      % (self.db_name, self.nspam, self.nham)
        else:
            # new database
            if options["globals", "verbose"]:
                print >> sys.stderr, self.db_name,'is a new database'
            self.nspam = 0
            self.nham = 0
开发者ID:ArildF,项目名称:rogie,代码行数:31,代码来源:storage.py


示例8: _cursor

    def _cursor(self, settings):
        set_tz = False
        if self.connection is None:
            set_tz = True
            if settings.DATABASE_NAME == "":
                from django.core.exceptions import ImproperlyConfigured

                raise ImproperlyConfigured("You need to specify DATABASE_NAME in your Django settings file.")
            conn_string = "dbname=%s" % settings.DATABASE_NAME
            if settings.DATABASE_USER:
                conn_string = "user=%s %s" % (settings.DATABASE_USER, conn_string)
            if settings.DATABASE_PASSWORD:
                conn_string += " password='%s'" % settings.DATABASE_PASSWORD
            if settings.DATABASE_HOST:
                conn_string += " host=%s" % settings.DATABASE_HOST
            if settings.DATABASE_PORT:
                conn_string += " port=%s" % settings.DATABASE_PORT
            self.connection = Database.connect(conn_string, **self.options)
            self.connection.set_isolation_level(1)  # make transactions transparent to all cursors
        cursor = self.connection.cursor()
        if set_tz:
            cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE])
        cursor.execute("SET client_encoding to 'UNICODE'")
        cursor = UnicodeCursorWrapper(cursor, "utf-8")
        return cursor
开发者ID:paulo-sergio-softlog,项目名称:geraldo,代码行数:25,代码来源:base.py


示例9: __init__

	def __init__(self, hostname, dbname, schema, type, output, orgn='sc'):
		self.conn = psycopg.connect('host=%s dbname=%s'%(hostname, dbname))
		self.curs = self.conn.cursor()
		self.curs.execute("set search_path to %s"%schema)
		
		self.type_dict = {0:'molecular_function', 1:'biological_process', 2:'cellular_component'}
		self.type = self.type_dict[int(type)]
		self.ofname = output
		self.org_short2long = {'at':'Arabidopsis thaliana',
			'ce':'Caenorhabditis elegans',
			'dm':'Drosophila melanogaster',
			'hs':'Homo sapiens',
			'mm':'Mus musculus',
			'sc':'Saccharomyces cerevisiae',
			'Arabidopsis thaliana':'Arabidopsis thaliana',
			'Caenorhabditis elegans':'Caenorhabditis elegans',
			'Drosophila melanogaster':'Drosophila melanogaster',
			'Homo sapiens':'Homo sapiens',
			'Mus musculus':'Mus musculus',
			'Gorilla gorilla Pan paniscus Homo sapiens':'Homo sapiens',
			'Saccharomyces cerevisiae':'Saccharomyces cerevisiae'}
		self.organism = self.org_short2long[orgn]
		self.log_file = open('/tmp/GO_graphxml.log', 'w')		
		self.termid_dict = {}
		self.acc2id_dict = {}
		self.go_graph = Graph.Graph()
开发者ID:polyactis,项目名称:annot,代码行数:26,代码来源:GO_graphxml.py


示例10: __init__

	def __init__(self, hostname, dbname, schema, orgn, needcommit=0):
		"""
		08-30-05
			add rn to org_short2long
			remove self.organism
		"""
		self.conn = psycopg.connect('host=%s dbname=%s'%(hostname, dbname))
		self.curs = self.conn.cursor()
		self.curs.execute("set search_path to %s"%schema)
		self.needcommit = int(needcommit)
		self.org_short2long = {'at':'Arabidopsis thaliana',
			'ce':'Caenorhabditis elegans',
			'dm':'Drosophila melanogaster',
			'hs':'Homo sapiens',
			'mm':'Mus musculus',
			'sc':'Saccharomyces cerevisiae',
			'rn':'Rattus norvegicus',
			'Rattus norvegicus':'Rattus norvegicus',
			'Arabidopsis thaliana':'Arabidopsis thaliana',
			'Caenorhabditis elegans':'Caenorhabditis elegans',
			'Drosophila melanogaster':'Drosophila melanogaster',
			'Homo sapiens':'Homo sapiens',
			'Mus musculus':'Mus musculus',
			'Gorilla gorilla Pan paniscus Homo sapiens':'Homo sapiens',
			'Saccharomyces cerevisiae':'Saccharomyces cerevisiae'}
		#mapping between gene_no and GO list
		self.geneno_go_dict = {}
		#mapping between gene_no and gene_id
		self.geneno_to_geneid = {}
开发者ID:polyactis,项目名称:annot,代码行数:29,代码来源:gene_go_functions.py


示例11: __init__

	def __init__(self, dir, hostname, dbname, orgn, log, needcommit=0):
		self.dir = dir
		self.conn = psycopg.connect('host=%s dbname=%s'%(hostname, dbname))
		self.curs = self.conn.cursor()
		self.curs.execute("set search_path to graph")
		self.org_short2long = {'at':'Arabidopsis thaliana',
			'ce':'Caenorhabditis elegans',
			'dm':'Drosophila melanogaster',
			'hs':'Homo sapiens',
			'mm':'Mus musculus',
			'sc':'Saccharomyces cerevisiae',
			'Arabidopsis thaliana':'Arabidopsis thaliana',
			'Caenorhabditis elegans':'Caenorhabditis elegans',
			'Drosophila melanogaster':'Drosophila melanogaster',
			'Homo sapiens':'Homo sapiens',
			'Mus musculus':'Mus musculus',
			'Gorilla gorilla Pan paniscus Homo sapiens':'Homo sapiens',
			'Saccharomyces cerevisiae':'Saccharomyces cerevisiae'}
		self.organism = self.org_short2long[orgn]
		self.log = int(log)
		if self.log:
			self.logfile = open('/tmp/gene_id_to_no.log', 'w')
		self.needcommit = int(needcommit)
		#records down the maximum gene_no ever assigned.
		self.max_gene_no = 0
		#mapping between gene_id and gene_no
		self.vertex_dict = {}
		self.vertex_dict_extension = {}
		#a unique collection of all genes in the datasets of the directory
		self.gene_set = Set()
开发者ID:polyactis,项目名称:annot,代码行数:30,代码来源:gene_id_to_no.py


示例12: __init__

	def __init__(self, hostname, dbname, schema, table, mcl_table, tag, p_value_list, unknown_list, connectivity_list,\
			recurrence_list, size_list, leave_one_out, wu, judger_type, depth_list, dir_files=None, dominant=0, needcommit=0,\
			needcommit_of_gene_stat=0, gene_table='p_gene'):
		self.hostname = hostname
		self.dbname = dbname
		self.schema = schema
		self.conn = psycopg.connect('host=%s dbname=%s'%(hostname, dbname))
		self.curs = self.conn.cursor()
		self.curs.execute("set search_path to %s"%schema)
		self.table = table
		self.mcl_table = mcl_table
		self.tag = tag
		self.p_value_list = p_value_list
		self.unknown_list = unknown_list
		self.connectivity_list = connectivity_list
		self.recurrence_list = recurrence_list
		self.cluster_size_list = size_list
		self.leave_one_out = int(leave_one_out)
		self.wu = int(wu)
		self.judger_type = int(judger_type)
		self.depth_list = depth_list
		self.dir_files = dir_files
		self.dominant = int(dominant)
		self.needcommit = int(needcommit)
		#a dictionary mapping the user choices to stat classes
		#self.stat_class_dict = {1: gene_stat,
		#	0: gene_stat_on_mcl_result}
		self.stat_data = []


		#default parameters to invoke gene_stat
		self.report = 0
		self.log = 0
		self.needcommit_of_gene_stat = int(needcommit_of_gene_stat)
		self.gene_table = gene_table
开发者ID:polyactis,项目名称:annot,代码行数:35,代码来源:batch_stat.py


示例13: _cursor

 def _cursor(self, settings):
     set_tz = False
     if self.connection is None:
         set_tz = True
         if settings.DATABASE_NAME == '':
             from django.core.exceptions import ImproperlyConfigured
             raise ImproperlyConfigured("You need to specify DATABASE_NAME in your Django settings file.")
         conn_string = "dbname=%s" % settings.DATABASE_NAME
         if settings.DATABASE_USER:
             conn_string = "user=%s %s" % (settings.DATABASE_USER, conn_string)
         if settings.DATABASE_PASSWORD:
             conn_string += " password='%s'" % settings.DATABASE_PASSWORD
         if settings.DATABASE_HOST:
             conn_string += " host=%s" % settings.DATABASE_HOST
         if settings.DATABASE_PORT:
             conn_string += " port=%s" % settings.DATABASE_PORT
         self.connection = Database.connect(conn_string, **self.options)
         self.connection.set_isolation_level(1) # make transactions transparent to all cursors
     cursor = self.connection.cursor()
     if set_tz:
         cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE])
         if not hasattr(self, '_version'):
             version = get_version(cursor)
             self.__class__._version = version
             if version < (8, 0):
                 # No savepoint support for earlier version of PostgreSQL.
                 self.features.uses_savepoints = False
     cursor.execute("SET client_encoding to 'UNICODE'")
     cursor = UnicodeCursorWrapper(cursor, 'utf-8')
     return cursor
开发者ID:hugs,项目名称:django,代码行数:30,代码来源:base.py


示例14: sql_open_connection

 def sql_open_connection(self):
     db = connection_dict(self.config, 'database')
     logging.getLogger('hyperdb').info('open database %r'%db['database'])
     try:
         conn = psycopg.connect(**db)
     except psycopg.OperationalError, message:
         raise hyperdb.DatabaseError, message
开发者ID:fillarikanava,项目名称:old-fillarikanava,代码行数:7,代码来源:back_postgresql.py


示例15: __init__

	def __init__(self, fname, dbname, schema, needcommit=0):
		self.reader = csv.reader(open(fname, 'r'), delimiter='\t')
		self.conn = psycopg.connect('dbname=%s'%dbname)
		self.curs = self.conn.cursor()
		self.curs.execute("set search_path to %s"%schema)
		self.needcommit = int(needcommit)
		self.go_id_dict = {}
开发者ID:polyactis,项目名称:annot,代码行数:7,代码来源:go_index.py


示例16: run

	def run(self):
		"""
		05-14-05
		06-30-05
			add gph_dir
		
		--dstruc_loadin()
		if self.schema:
			--cor_vector_from_db
			or
			--cor_vector_from_files

		"""
		if self.schema:
			self.conn = psycopg.connect('host=%s dbname=%s'%(self.hostname, self.dbname))
			self.curs = self.conn.cursor()
			self.curs.execute("set search_path to %s"%self.schema)
		else:
			if self.dir == None:
				sys.stderr.write("Either schema or data directory should be specified\n")
				sys.exit(2)
		communicator = MPI.world.duplicate()
		
		self.dstruc_loadin(communicator)
		
		self.mpi_synchronize(communicator)
		
		if self.schema:
			self.cor_vector_from_db(self.output_file)
		else:
			if self.significance_file==None:
				sys.stderr.write("Error: where's the significance file?\n")
				sys.exit(2)
			self.cor_vector_from_files(communicator, self.dir, self.gph_dir, self.output_file, \
				self.significance_file, self.p_value_cut_off, self.cor_cut_off)
开发者ID:polyactis,项目名称:annot,代码行数:35,代码来源:complete_cor_vector.py


示例17: __init__

	def __init__(self, fname, hostname, dbname, schema, parser, u_fname, orgn, needcommit=0):
		self.go_inf = open(fname, 'r')
		self.conn = psycopg.connect('host=%s dbname=%s'%(hostname, dbname))
		self.curs = self.conn.cursor()
		self.curs.execute("set search_path to %s"%schema)
		self.parser = parser_map[parser]
		self.reader = csv.reader(open(u_fname, 'r'), delimiter=';')
		self.needcommit = int(needcommit)
		self.org_short2long = {'at':'Arabidopsis thaliana',
			'ce':'Caenorhabditis elegans',
			'dm':'Drosophila melanogaster',
			'hs':'Homo sapiens',
			'mm':'Mus musculus',
			'sc':'Saccharomyces cerevisiae',
			'Arabidopsis thaliana':'Arabidopsis thaliana',
			'Caenorhabditis elegans':'Caenorhabditis elegans',
			'Drosophila melanogaster':'Drosophila melanogaster',
			'Homo sapiens':'Homo sapiens',
			'Mus musculus':'Mus musculus',
			'Gorilla gorilla Pan paniscus Homo sapiens':'Homo sapiens',
			'Saccharomyces cerevisiae':'Saccharomyces cerevisiae'}
		self.organism = self.org_short2long[orgn]
		#mapping between gene_id and gene_no
		self.vertex_dict = {}
		#stores all the unknown genes in schema.gene
		self.unknown_gene_list = []
		#GO DAG
		self.go_graph = Graph.Graph()
开发者ID:polyactis,项目名称:annot,代码行数:28,代码来源:go_bioprocess.py


示例18: __init__

	def __init__(self, hostname, dbname, orgn, unknown_file):
		"""
		08-30-05
			add rn to org_short2long
		"""
		self.conn = psycopg.connect('host=%s dbname=%s'%(hostname, dbname))
		self.curs = self.conn.cursor()
		self.org_short2long = {'at':'Arabidopsis thaliana',
			'ce':'Caenorhabditis elegans',
			'dm':'Drosophila melanogaster',
			'hs':'Homo sapiens',
			'mm':'Mus musculus',
			'sc':'Saccharomyces cerevisiae',
			'rn':'Rattus norvegicus',
			'Rattus norvegicus':'Rattus norvegicus',
			'Arabidopsis thaliana':'Arabidopsis thaliana',
			'Caenorhabditis elegans':'Caenorhabditis elegans',
			'Drosophila melanogaster':'Drosophila melanogaster',
			'Homo sapiens':'Homo sapiens',
			'Mus musculus':'Mus musculus',
			'Gorilla gorilla Pan paniscus Homo sapiens':'Homo sapiens',
			'Saccharomyces cerevisiae':'Saccharomyces cerevisiae'}
		self.organism = self.org_short2long[orgn]
		self.unknown_file = open(unknown_file, 'w')
		#data structure to store biological_process known genes
		self.known_genes_set = Set()
		#data structure to store biological_process unknown genes
		self.unknown_genes_set = Set()
开发者ID:polyactis,项目名称:annot,代码行数:28,代码来源:find_unknown_genes.py


示例19: import_csv

def import_csv(writer_security, map_sec, map_headers):
    s = "host=localhost dbname=mra user='postgres' port=5432 password='postgres'"
    handle=psycopg.connect(s)
    cr = handle.cursor()
    #cr.execute("select model as model_id,'1' as perm_read,  model as name,'1' as perm_create,'1' as perm_unlink,'1' as perm_write,res_groups.name as group_id from ir_model,res_groups where model like '%cci%' order by model")
    cr.execute("select ir_model.name as model_id,'1' as perm_read,  ir_model.name as name,'1' as perm_create,'1' as perm_unlink,'1' as perm_write,res_groups.name as group_id from ir_model,res_groups  where model like '%cci%' or model like 'account%' or model like 'sale%' or model like 'audittrail%' or model like 'res.partner%' or model like 'meeting%' or model like 'crm%' or model like 'event%' or model like 'res.company' or model like 'res.con%' or model like 'purchase%' \
                or model like 'credit%' or model like 'translation' or model like 'letter%' or model like 'membership' \
                or model like 'product%' or model like 'project%' or model like 'payment%' or model like 'crossovered%' \
                or model like 'hr%' order by model")
    d=[]
    record = {}
#    for key, column_name in map_headers.items():
#        record[key] = column_name
    #record1 = ['model_id', 'group_id', 'perm_read', 'perm_create', 'perm_unlink', 'perm_write']
    record = {'model_id': 'model_id', 'group_id': 'group_id',  'perm_read': 'perm_read', 'perm_unlink': 'perm_unlink', 'perm_write': 'perm_write', 'perm_create': 'perm_create','name':'name'}
    writer_security.writerow(record)

    for i in cr.fetchall():
#        for j in range(len(i)):
        record = {}
        j=0
        for key,fnct in map_sec.items():
            record[key] =  i[j]
            j=j+1
        writer_security.writerow(record)
开发者ID:3dfxmadscientist,项目名称:odoo-extra-1,代码行数:25,代码来源:import.py


示例20: get_cursor

def get_cursor(config):
    """Setup database connection."""
    dbname = config.get('database', 'name')
    dbuser = config.get('database', 'user')
    dbpass = config.get('database', 'password')
    dbconn = psycopg.connect(database=dbname, user=dbuser, password=dbpass)
    return dbconn, dbconn.cursor()
开发者ID:Carreau,项目名称:pypi-legacy,代码行数:7,代码来源:apache_count_dist.py



注:本文中的psycopg.connect函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python psycopg2.connect函数代码示例发布时间:2022-05-25
下一篇:
Python gevent.patch_psycopg函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap