Creates FDW for the partition.

        Args:
            connection:
            partition (orm.Partition):
347594
def _add_partition(self, connection, partition):
        
        logger.debug('Creating foreign table for partition.\n    partition: {}'.format(partition.name))
        with connection.cursor() as cursor:
            postgres_med.add_partition(cursor, partition.datafile, partition.vid)
487536
def add(self, connection):
        ''''''
        key = (connection.host, connection.port)
        with self._lock:
            if key not in self._connections:
                self._connections[key] = connection
                self.added(connection)
                return connection
            else:
                return None
37154
public void createTables(Connection connection, TableCreationMode mode, boolean createIndexes) {
        ArrayList<Type<?>> sorted = sortTypes();
        try (Statement statement = connection.createStatement()) {
            if (mode == TableCreationMode.DROP_CREATE) {
                ArrayList<Type<?>> reversed = sortTypes();
                Collections.reverse(reversed);
                executeDropStatements(statement, reversed);
            }
            for (Type<?> type : sorted) {
                String sql = tableCreateStatement(type, mode);
                statementListeners.beforeExecuteUpdate(statement, sql, null);
                statement.execute(sql);
                statementListeners.afterExecuteUpdate(statement, 0);
            }
            if (createIndexes) {
                for (Type<?> type : sorted) {
                    createIndexes(connection, mode, type);
                }
            }
        } catch (SQLException e) {
            throw new TableModificationException(e);
        }
    }
1039450
def create_new_connection(options, &block)
      if @connection
        logger.debug("[WinRM] shutting previous connection #{@connection}")
        @connection.close
      end

      @connection_options = options
      @connection = Connection.new(options, &block)
    end
498619
async def create_connection(self, address=None, protocol_factory=None,
                                **kwargs):
        
        loop = self._loop
        protocol_factory = protocol_factory or self.create_protocol
        if isinstance(address, tuple):
            kwargs['host'] = address[0]
            kwargs['port'] = address[1]
        _, protocol = await loop.create_connection(protocol_factory, **kwargs)
        event = protocol.event('connection_made')
        if not event.fired():
            await event.waiter()
        return protocol
833700
def create_dcnm_out_part(self, tenant_id, fw_dict, is_fw_virt=False):
        
        res = fw_const.DCNM_OUT_PART_CREATE_SUCCESS
        tenant_name = fw_dict.get('tenant_name')
        ret = True
        try:
            self._create_out_partition(tenant_id, tenant_name)
        except Exception as exc:
            LOG.error("Create of Out Partition failed for tenant "
                      "%(tenant)s ,Exception %(exc)s",
                      {'tenant': tenant_id, 'exc': str(exc)})
            res = fw_const.DCNM_OUT_PART_CREATE_FAIL
            ret = False
        self.update_fw_db_result(tenant_id, dcnm_status=res)
        LOG.info("Out partition created")
        return ret
611860
def run(connection):
    

    parser = argparse.ArgumentParser(description="""
    Process database dumps.

    Either download of upload a dump file to the objectstore.

    downloads the latest dump and uploads with envronment and date
    into given container destination
    """)

    parser.add_argument(
        'location',
        nargs=1,
        default=f'{DUMPFOLDER}/database.{ENV}.dump',
        help="Dump file location")

    parser.add_argument(
        'objectstore',
        nargs=1,
        default=f'{DUMPFOLDER}/database.{ENV}.dump',
        help="Dump file objectstore location")

    parser.add_argument(
        '--download-db',
        action='store_true',
        dest='download',
        default=False,
        help='Download db')

    parser.add_argument(
        '--upload-db',
        action='store_true',
        dest='upload',
        default=False,
        help='Upload db')

    parser.add_argument(
        '--container',
        action='store_true',
        dest='container',
        default=False,
        help='Upload db')

    parser.add_argument(
        '--days',
        type=int,
        nargs=1,
        dest='days',
        default=0,
        help='Days to keep database dumps')

    args = parser.parse_args()

    if args.days:
        LOG.debug('Cleanup old dumps')
        remove_old_dumps(
            connection, args.objectstore[0], args.days[0])
    elif args.download:
        download_database(
            connection, args.objectstore[0], args.location[0])
    elif args.upload:
        upload_database(
            connection, args.objectstore[0], args.location[0])
    else:
        parser.print_help()
774038
def initialize_schema(connection):
  
  cursor = connection.cursor()
  cursor.execute("PRAGMA application_id={}".format(_TENSORBOARD_APPLICATION_ID))
  cursor.execute("PRAGMA user_version={}".format(_TENSORBOARD_USER_VERSION))
  with connection:
    for statement in _SCHEMA_STATEMENTS:
      lines = statement.strip('\n').split('\n')
      message = lines[0] + ('...' if len(lines) > 1 else '')
      logger.debug('Running DB init statement: %s', message)
      cursor.execute(statement)
1367554
def create_pool(module, max_conns, *args, **kwargs):
    
    if not hasattr(module, 'threadsafety'):
        raise NotSupported("Cannot determine driver threadsafety.")
    if max_conns < 1:
        raise ValueError("Minimum number of connections is 1.")
    if module.threadsafety >= 2:
        return Pool(module, max_conns, *args, **kwargs)
    if module.threadsafety >= 1:
        return DummyPool(module, *args, **kwargs)
    raise ValueError("Bad threadsafety level: %d" % module.threadsafety)
857029
def create_schema(self, connection):
        
        if '.' not in self.table:
            return

        query = 'CREATE SCHEMA IF NOT EXISTS {schema_name};'.format(schema_name=self.table.split('.')[0])
        connection.cursor().execute(query)
365407
protected function createRedirectUrisTable(Connection $connection, DatabaseSchemaInterface $schema): void
    {
        $manager = $connection->getSchemaManager();

        $table = new Table($schema->getRedirectUrisTable());
        $table->addColumn($schema->getRedirectUrisIdentityColumn(), Type::INTEGER)
            ->setNotnull(true)->setAutoincrement(true)->setUnsigned(true);
        $table->addColumn($schema->getRedirectUrisClientIdentityColumn(), Type::STRING)->setNotnull(true);
        $table->addColumn($schema->getRedirectUrisValueColumn(), Type::STRING)->setNotnull(true);
        $table->addColumn($schema->getRedirectUrisCreatedAtColumn(), Type::DATETIME)->setNotnull(true);
        $table->addColumn($schema->getRedirectUrisUpdatedAtColumn(), Type::DATETIME)->setNotnull(false);
        $table->setPrimaryKey([$schema->getRedirectUrisIdentityColumn()]);

        $table->addForeignKeyConstraint(
            $schema->getClientsTable(),
            [$schema->getRedirectUrisClientIdentityColumn()],
            [$schema->getClientsIdentityColumn()],
            $this->getOnDeleteCascadeConstraint()
        );

        $manager->dropAndCreateTable($table);
    }
1355433
def create(self, width=0, depth=0, path=None, flags=0, seed=0):
        
        return self.create_method(self, width, depth, path, flags, seed)
140185
def setConnection(self, connection):
        
        # define custom properties
        if not isinstance(connection, orb.Connection):
            conn = orb.Connection.byName(connection)
            if not conn:
                raise orb.errors.BackendNotFound(connection)
            connection = conn(self)
        else:
            connection.setDatabase(self)

        self.__connection = connection
1032901
def make_connection(self, node):
        
        if self.count_all_num_connections(node) >= self.max_connections:
            if self.max_connections_per_node:
                raise RedisClusterException("Too many connection ({0}) for node: {1}"
                                            .format(self.count_all_num_connections(node),
                                                    node['name']))

            raise RedisClusterException("Too many connections")

        self._created_connections_per_node.setdefault(node['name'], 0)
        self._created_connections_per_node[node['name']] += 1
        connection = self.connection_class(host=node["host"],
                                           port=node["port"],
                                           **self.connection_kwargs)

        # Must store node in the connection to make it eaiser to track
        connection.node = node

        return connection
1308232
async def _create_connection(self, req: 'ClientRequest',
                                 traces: List['Trace'],
                                 timeout: 'ClientTimeout') -> ResponseHandler:
        
        if req.proxy:
            _, proto = await self._create_proxy_connection(
                req, traces, timeout)
        else:
            _, proto = await self._create_direct_connection(
                req, traces, timeout)

        return proto
624188
def connectionMade(self):
        
        cmd = stomper.connect(self.username, self.password)
        self.transport.write(cmd)
1145872
async def create(cls, fsm_context: FSMContext):
        
        proxy = cls(fsm_context)
        await proxy.load()
        return proxy