Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8178341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:44:23+00:00 2026-06-06T23:44:23+00:00

I have a local sqlite server. The SQL database only contains a table called

  • 0

I have a local sqlite server. The SQL database only contains a table called flights. This table flights only contains two columns: dt and flight. It is created like so: CREATE TABLE IF NOT EXISTS flight (dt INT NOT NULL, flight INT PRIMARY KEY);. dt is meant to stand for datetime. This column dt holds time and date stamps for each flight. The flight column is meant to be an auto increment id for each flight.

I now need to create the flight and record the ID. But I think my method below is incredibly stupid. There has to be a better way than this. The code below does not work thus adding to the stupidity of my attempt. It returns currently prints (None,).

For added clarification, all I need to do is add a flight with the provided time stamp. Then find the id of the flight I just created. Should be simple enough.

t = (int(time.time()),)
conn, c = AT.startSQLdb()
c.execute("INSERT INTO flight VALUES (?,NULL);",t)
c.execute("SELECT flight FROM flight WHERE dt=?;",t)
print c.fetchone()
conn.commit()

By the way, AT.startSQLdb() is just a method that returns a tuple (sql connection, sql cursor). I just have it as a function to keep the start up functionality the same for all threads.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:44:24+00:00Added an answer on June 6, 2026 at 11:44 pm

    You can select the last auto-assigned id with this SQL:

    SELECT last_insert_rowid()
    

    BTW: you mention threads, SQLite is not great with concurrent access, so be careful with multiple threads.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a local SQLite table breadcrumbs being created on the Android device.
we have a local staging server running sql server 2000 and a remote public
I have an iPhone (iOS) app that keeps data in a local SQLite database
I have a centrally hosted database (MS SQL Server) and distributed clients save data
I have local server for my site (i made it with XAMPP). How can
I have a local Database running on localhost:3306, which I access with MySQL Workbench.
I have an sqlite database whose data I need to transfer over the network,
I have following Scenario: PHP(Server, Writer) ----> MySQL Database <------ PHP(Client, Reader/ Writer); PHPS
We have a database on our master server (PHP/MySQL) that stores our data thats
I was previously using a database in SQL Server CE . That's kind of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.