> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devinenterprise.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Query di dati ad hoc su Slack

export const UseCaseHero = ({title, description, prompt, category, features, devinUrl, agent, intent, playbookId, type}) => {
  const encodedPrompt = encodeURIComponent(prompt || '');
  const tag = 'docs-use-case-gallery';
  const utm = 'utm_source=docs&utm_medium=use-case-gallery&utm_campaign=hero-cta';
  const agentParams = (agent ? '&agent=' + agent : '') + (intent ? '&intent=' + intent : '') + (playbookId ? '&playbookId=' + playbookId : '');
  const devinHref = type === 'schedule' ? 'https://app.devin.ai/settings/schedules/create?' + utm + agentParams + (prompt ? '&prompt=' + encodedPrompt : '') : type === 'review' ? 'https://app.devin.ai/review?' + utm : agent === 'ada' ? 'https://app.devin.ai/search?' + utm + '&noSubmit=true' + (prompt ? '&prompt=' + encodedPrompt : '') : devinUrl ? devinUrl.includes('?') ? devinUrl + '&' + utm + agentParams : devinUrl + '?' + utm + agentParams : prompt ? 'https://app.devin.ai/?tags=' + tag + '&' + utm + agentParams + '&prompt=' + encodedPrompt : 'https://app.devin.ai/?' + utm + agentParams;
  const buttonLabel = type === 'schedule' ? 'Schedule in Devin ↗' : type === 'review' ? 'Set Up Devin Review ↗' : agent === 'advanced' ? 'Try in Devin ↗' : agent === 'dana' ? 'Try in Dana ↗' : agent === 'ada' ? 'Try in Ask Devin ↗' : 'Try in Devin ↗';
  const featureList = features ? features.split(',').map(f => f.trim()) : [];
  return <div className="uc-hero">
      <div className="uc-hero-inner">
        <div className="uc-hero-left">
          <h1 className="uc-hero-title">{title}</h1>
          <p className="uc-hero-desc">{description}</p>
          <div>
            <a href={devinHref} target="_blank" rel="noopener noreferrer" className="try-in-devin-btn">
              {buttonLabel}
            </a>
          </div>
        </div>
        <div className="uc-hero-meta">
          <div className="uc-meta-item">
            <span className="uc-meta-label">Author</span>
            <span className="uc-meta-value">Cognition</span>
          </div>
          <div className="uc-meta-item">
            <span className="uc-meta-label">Category</span>
            <span className="uc-meta-value">{category}</span>
          </div>
          {featureList.length > 0 && <div className="uc-meta-item">
              <span className="uc-meta-label">Features</span>
              <span className="uc-meta-value">{featureList.join(', ')}</span>
            </div>}
        </div>
      </div>
    </div>;
};

export const PromptBlock = ({children, type, agent, intent, playbookId}) => {
  var utm = 'utm_source=docs&utm_medium=use-case-gallery&utm_campaign=prompt-block';
  var tag = 'docs-use-case-gallery';
  var agentParams = (agent ? '&agent=' + agent : '') + (intent ? '&intent=' + intent : '') + (playbookId ? '&playbookId=' + playbookId : '');
  var label = type === 'schedule' ? 'Schedule in Devin' : type === 'playbook' ? 'Create Playbook' : type === 'knowledge' ? 'Add to Knowledge' : agent === 'advanced' ? 'Try in Devin' : agent === 'dana' ? 'Try in Dana' : agent === 'ada' ? 'Try in Ask Devin' : 'Try in Devin';
  var buildUrl = function (text) {
    var encoded = encodeURIComponent(text);
    if (type === 'schedule') return 'https://app.devin.ai/settings/schedules/create?' + utm + agentParams + '&prompt=' + encoded;
    if (type === 'playbook') return 'https://app.devin.ai/settings/playbooks/create?' + utm + '&body=' + encoded;
    if (type === 'knowledge') return 'https://app.devin.ai/knowledge?' + utm + '&body=' + encoded;
    if (agent === 'ada') return 'https://app.devin.ai/search?' + utm + '&noSubmit=true&prompt=' + encoded;
    return 'https://app.devin.ai/?tags=' + tag + '&' + utm + agentParams + '&prompt=' + encoded;
  };
  const ref = React.useRef(null);
  const [href, setHref] = React.useState('#');
  React.useEffect(() => {
    if (!ref.current) return;
    var codeEl = ref.current.querySelector('pre code');
    if (codeEl) {
      var text = codeEl.textContent.trim();
      if (text) setHref(buildUrl(text));
    }
    var header = ref.current.querySelector('[data-component-part="code-block-header"]');
    if (header && !header.querySelector('.prompt-block-devin-link')) {
      var link = document.createElement('a');
      link.href = href;
      link.target = '_blank';
      link.rel = 'noopener noreferrer';
      link.className = 'prompt-block-devin-link';
      link.style.cssText = 'display:inline-flex;align-items:center;gap:6px;text-decoration:none;color:#fff;font-size:11px;font-weight:500;padding:4px 10px;border-radius:6px;white-space:nowrap;background:#317CFF;transition:background 0.2s;margin-left:8px;';
      link.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg> ' + label;
      link.onmouseenter = function () {
        link.style.background = '#2968D9';
      };
      link.onmouseleave = function () {
        link.style.background = '#317CFF';
      };
      header.appendChild(link);
    }
    var existingLink = ref.current.querySelector('.prompt-block-devin-link');
    if (existingLink && href !== '#') existingLink.href = href;
  });
  return <div className="prompt-block" ref={ref}>{children}</div>;
};

<UseCaseHero title="Query ad hoc sui dati in Slack" description="Digita /dana in qualsiasi canale Slack per interrogare il tuo database in semplice inglese." prompt="/dana Qual è stata la nostra crescita delle iscrizioni settimana su settimana, suddivisa per canale di acquisizione?" category="Dati e analisi" features="Integrazioni, MCP" agent="dana" />

<div className="uc-detail-wrapper">
  <Tip>Non vuoi configurare tutto manualmente? Incolla un collegamento a questa pagina in una sessione Devin e chiedigli di configurare tutto per te.</Tip>

  <Steps>
    <Step title="Collega un database nel MCP Marketplace">
      Dana ha bisogno di accedere ad almeno un database per rispondere alle domande. Vai a **Settings > [MCP Marketplace](/it/work-with-devin/mcp)** e abilita un MCP per database:

      | Data source     | MCP name   | Cosa ti servirà                                         |
      | --------------- | ---------- | ------------------------------------------------------- |
      | Amazon Redshift | Redshift   | Host, port, database, username, password                |
      | Google BigQuery | BigQuery   | OAuth (one-click) o account di servizio in formato JSON |
      | PostgreSQL      | PostgreSQL | Stringa di connessione                                  |
      | MySQL           | MySQL      | Stringa di connessione                                  |
      | Snowflake       | Snowflake  | Account, username, password                             |

      Fai clic su **Enable** sulla scheda MCP, inserisci le tue credenziali, quindi fai clic su **Test listing tools** per confermare che la connessione funzioni. Puoi collegare più database: Dana interrogherà quello più pertinente alla tua domanda.
    </Step>

    <Step title="Fai la tua prima domanda con /dana">
      [Dana](/it/work-with-devin/data-analyst) è la modalità analista dati di Devin — un agente specializzato con strumenti e prompt ottimizzati per interrogare database, creare grafici e rispondere a domande di business in inglese semplice.

      Apri qualsiasi canale Slack in cui [Devin è installato](/it/integrations/slack) e digita `/dana` seguito da una domanda in inglese semplice. Se il comando slash `/dana` non è disponibile nel tuo workspace, puoi anche usare `@Devin !dana ...` — entrambi funzionano allo stesso modo. Dana crea una sessione, scrive la query SQL, la esegue e risponde nel thread.

      <PromptBlock agent="dana">
        ```txt Ask Dana a question theme={null}
        /dana What were our top 10 customers by revenue last quarter?
        ```
      </PromptBlock>

      Puoi anche richiamare Dana menzionando Devin con la macro `!dana`:

      <PromptBlock agent="dana">
        ```txt Use the !dana macro theme={null}
        @Devin !dana How many active users do we have per plan tier this month?
        ```
      </PromptBlock>

      Dana risponde direttamente nel thread Slack con tabelle formattate, conteggi e — quando utile — una breve interpretazione dei risultati. Non è necessario passare a uno strumento di BI.

      Dana non è limitata a consultazioni rapide: è anche molto efficace per report completi e analisi approfondite. Chiedile di esaminare trend, segmentare i dati e sintetizzare risultati attraverso più query:

      <PromptBlock agent="dana">
        ```txt Deep analysis theme={null}
        /dana Conduct a deep investigation on our user growth over the past
        month. Which user segments and use cases can the growth be attributed
        to? Is it more growth in existing accounts (expansion) or top of
        funnel (new signups)? Break it down by acquisition channel and plan
        tier, and highlight any notable changes compared to the prior month.
        ```
      </PromptBlock>
    </Step>

    <Step title="Insegna a Dana il tuo schema e le tue convenzioni">
      Dana funziona subito, ma migliora notevolmente quando conosce il tuo schema e le tue definizioni di business. Invece di aggiungere manualmente voci in Knowledge, ti basta dare feedback direttamente a Dana — in Slack o nella webapp — e chiederle di ricordare le informazioni per la volta successiva:

      * *"Remember that 'active user' means at least one event in `analytics.events` in the past 30 days."*
      * *"All our timestamps are stored in UTC. Always convert to America/New\_York for display."*
      * *"`billing.subscriptions.mrr` is in cents, not dollars. Divide by 100 when showing revenue."*
      * *"Update your knowledge: the `plan` column values are free, pro, and enterprise — not basic/premium."*

      Dana può elencare e aggiornare il proprio Knowledge, quindi le correzioni si accumulano nel tempo. Più feedback fornisci — significato delle colonne, valori enum, regole sui fusi orari, definizioni di business — meno domande di follow-up Dana dovrà fare nelle query future.
    </Step>

    <Step title="Fai domande di follow-up nello stesso thread">
      Dana mantiene il contesto all'interno di un thread Slack, quindi le domande di follow-up possono fare riferimento ai risultati precedenti senza doverti ripetere.

      <PromptBlock agent="dana">
        ```txt Follow up on results theme={null}
        Break that down by plan tier and show the month-over-month trend.
        ```
      </PromptBlock>

      <PromptBlock agent="dana">
        ```txt Request a visualization theme={null}
        Can you chart daily signups for the past 90 days with a 7-day moving average?
        ```
      </PromptBlock>

      Per le domande che fai regolarmente, valuta di creare un [playbook](/it/product-guides/creating-playbooks) con le query e la formattazione esatte che desideri, quindi attivalo con un `!macro` personalizzato da Slack.
    </Step>
  </Steps>
</div>
