├── .github ├── ISSUE_TEMPLATE │ ├── bug_report_template.md │ ├── feature_request_template.md │ └── pull_request_template.md └── workflows │ ├── greetings.yml │ └── label.yml ├── .gitignore ├── .travis.yml ├── AmbSQL.py ├── AmbSql.html ├── CONTRIBUTING.md ├── CREDITS ├── Code_Of_Conduct.md ├── Documentation.html ├── LICENSE ├── MANIFEST.in ├── PR_template.md ├── README.md ├── ambsql ├── __init__.py └── ambsql.py ├── docs └── README.rst ├── download ├── css │ └── style.css ├── ico │ └── db.png └── index.html ├── homepage ├── ico │ └── db.png └── index.html ├── ico.JPG ├── images ├── Screenshot.PNG └── db.ico ├── requirements.txt ├── setup.cfg ├── setup.py └── style.css /.github/ISSUE_TEMPLATE/bug_report_template.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Additional context** 32 | Add any other context about the problem here. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request_template.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Issue that this pull request solves 2 | 3 | Closes: # (issue number) 4 | 5 | ## Proposed changes 6 | 7 | Brief description of what is fixed or changed 8 | 9 | ## Types of changes 10 | 11 | _Put an `x` in the boxes that apply_ 12 | 13 | - [ ] Bugfix (non-breaking change which fixes an issue) 14 | - [ ] New feature (non-breaking change which adds functionality) 15 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 16 | - [ ] Documentation update (Documentation content changed) 17 | - [ ] Other (please describe): 18 | 19 | ## Checklist 20 | 21 | _Put an `x` in the boxes that apply_ 22 | 23 | - [ ] My code follows the style guidelines of this project 24 | - [ ] I have performed a self-review of my own code 25 | - [ ] I have commented my code, particularly in hard-to-understand areas 26 | - [ ] I have made corresponding changes to the documentation 27 | - [ ] My changes generate no new warnings 28 | 29 | ## Screenshots 30 | 31 | Please attach the screenshots of the changes made in case of change in user interface 32 | 33 | ## Other information 34 | 35 | Any other information that is important to this pull request -------------------------------------------------------------------------------- /.github/workflows/greetings.yml: -------------------------------------------------------------------------------- 1 | name: Greetings 2 | 3 | on: [pull_request, issues] 4 | 5 | jobs: 6 | greeting: 7 | runs-on: ubuntu-latest 8 | permissions: 9 | issues: write 10 | pull-requests: write 11 | steps: 12 | - uses: actions/first-interaction@v1 13 | with: 14 | repo-token: ${{ secrets.GITHUB_TOKEN }} 15 | issue-message: 'Message that will be displayed on users first issue' 16 | pr-message: 'Message that will be displayed on users first pull request' 17 | -------------------------------------------------------------------------------- /.github/workflows/label.yml: -------------------------------------------------------------------------------- 1 | # This workflow will triage pull requests and apply a label based on the 2 | # paths that are modified in the pull request. 3 | # 4 | # To use this workflow, you will need to set up a .github/labeler.yml 5 | # file with configuration. For more information, see: 6 | # https://github.com/actions/labeler 7 | 8 | name: Labeler 9 | on: [pull_request] 10 | 11 | jobs: 12 | label: 13 | 14 | runs-on: ubuntu-latest 15 | permissions: 16 | contents: read 17 | pull-requests: write 18 | 19 | steps: 20 | - uses: actions/labeler@v2 21 | with: 22 | repo-token: "${{ secrets.GITHUB_TOKEN }}" 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #env 2 | env/ 3 | env 4 | # pycharm 5 | .idea/ 6 | .idea 7 | 8 | # Packages 9 | *.egg 10 | *.egg-info 11 | build 12 | dist 13 | dist/* 14 | eggs 15 | parts 16 | bin 17 | var 18 | sdist 19 | develop-eggs 20 | .installed.cfg 21 | lib 22 | lib64 23 | 24 | # Installer logs 25 | pip-log.txt 26 | 27 | AmbSQL.spec 28 | __pycache__/ 29 | 30 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language : python 2 | os: linux 3 | dist : xenial 4 | sudo : false 5 | python : 3.6 6 | script: pytest 7 | group : stable -------------------------------------------------------------------------------- /AmbSQL.py: -------------------------------------------------------------------------------- 1 | #!usr/bin/env python3 2 | import sys 3 | import getpass 4 | import string 5 | import sqlite3 6 | import os 7 | import datetime 8 | if(os.name=='nt'): 9 | os.system("title "+"AmbSQL") 10 | try: 11 | os.system("IF NOT EXIST C:\AmbSQL MKDIR C:\AmbSQL") # Create Folder AmbSQL for storage of Database file 12 | except: 13 | pass 14 | path = 'C:\\AmbSQL\\' 15 | # For Linux and MacOS 16 | else: 17 | try: 18 | os.system("mkdir -p /home/"+os.getlogin()+"/DB") 19 | except: 20 | pass 21 | path = '/home/'+os.getlogin()+'/DB/' 22 | db = sqlite3.connect(path+"dtables.db") # Connect to Tables Database 23 | c = db.cursor() 24 | dbu = sqlite3.connect(path+"duser.db") # Connect to Users Database 25 | cu = dbu.cursor() 26 | cu.execute("CREATE TABLE IF NOT EXISTS USERS(id INTEGER PRIMARY KEY,user TEXT,pass TEXT)") 27 | dbu.commit() 28 | usern = "" 29 | def main(cnt): 30 | if(os.name == 'nt'): 31 | os.system("cls") 32 | else: 33 | os.system("clear") 34 | print("AmbSQL shell version: 1.0.2 "+str(datetime.datetime.now())) 35 | print("") 36 | print("Type 'docs()' for documentation") 37 | print("") 38 | while(True): 39 | try: 40 | command = input("> ").lower().strip() # Input Command 41 | if(command == "connect"): 42 | cnt = 0 43 | usern = str(input("Enter user-name: ")).lower().strip() # Input Username 44 | passw = str(getpass.getpass('Enter password: ')) # Input Password 45 | # Username, Password Auth 46 | if(usern == "system" and passw == "123"): 47 | cnt = 1 48 | print("Connected.") 49 | else: 50 | temp = cu.execute("SELECT USER,PASS FROM USERS WHERE USER= ? AND PASS= ?", (usern, passw)) 51 | for i in temp: 52 | if(str(i[0]) == str(usern) and str(i[1]) == str(passw)): 53 | cnt = 1 54 | print("Connected.") 55 | break 56 | if(cnt == 0): 57 | print("Username or Password entered wrong!!") 58 | del usern 59 | del temp 60 | # Create Table 61 | elif(command.startswith("createtable(") and command.endswith(")")): 62 | if (cnt != 1): 63 | print("ERROR: Not Connected !!") 64 | else: 65 | abc = command[12:-1].upper() 66 | if (len(abc) != 0): 67 | l1 = abc.split(",") 68 | if (len(l1) >= 2): 69 | tname = l1[0] 70 | a = [] 71 | for i in range(1, len(l1)): 72 | a.insert(i - 1, l1[i].lower().strip()) 73 | try: 74 | c.execute("CREATE TABLE " + tname +" (id INTEGER PRIMARY KEY,last_mod TEXT)") 75 | for j in range(1, len(l1)): 76 | c.execute("ALTER TABLE " + tname +" ADD " + a[j - 1] + " TEXT") 77 | db.commit() 78 | print("Table Created.") 79 | except: 80 | print("ERROR!! Table Name and Attribute name should be unique!") 81 | del tname, a 82 | else: 83 | print("ERROR!! There should be atleast two Parameters!") 84 | del l1 85 | else: 86 | print("ERROR!! Please Enter the Table name!") 87 | del abc 88 | 89 | # Sum Values of an Attribute in Table 90 | elif(command.startswith("sumvalue(") and command.endswith(")")): 91 | if(cnt != 1): 92 | print("ERROR: Not Connected") 93 | else: 94 | try: 95 | abc = command[9:-1].strip() 96 | if(len(abc) != 0): 97 | l1 = abc.split(",") 98 | if(len(l1) == 2): 99 | tname = str(l1[0]) 100 | attr = str(l1[1]) 101 | 102 | c.execute("SELECT SUM("+attr+") FROM " + tname) 103 | ans = list(c.fetchone()) 104 | ans = str(ans).strip('[]') 105 | print("Sum : " + ans) 106 | del ans, tname, attr, l1 107 | else: 108 | print("Error: There should be only two parameters") 109 | else: 110 | print("ERROR: Please Enter the command correctly") 111 | 112 | del abc 113 | except: 114 | print("ERROR: Please Enter the parameters correctly") 115 | 116 | 117 | 118 | 119 | # Max Value of an Attribute in Table 120 | #Note: It only works on Integer-type (numerical attributes) 121 | elif(command.startswith("maxvalue(") and command.endswith(")")): 122 | if(cnt != 1): 123 | print("ERROR: Not Connected") 124 | else: 125 | try: 126 | abc = command[9:-1].strip() 127 | if(len(abc) != 0): 128 | l1 = abc.split(",") 129 | if(len(l1) == 2): 130 | tname = str(l1[0]) 131 | attr = str(l1[1]) 132 | 133 | c.execute("SELECT MAX("+attr+") FROM " + tname) 134 | ans = list(c.fetchone()) 135 | ans = str(ans).strip('[]') 136 | print("Max : " + ans) 137 | del ans, tname, attr, l1 138 | else: 139 | print("Error: There should be only two parameters") 140 | else: 141 | print("ERROR: Please Enter the command correctly") 142 | 143 | del abc 144 | except: 145 | print("ERROR: Please Enter the parameters correctly") 146 | 147 | # Min Value of an Attribute in Table 148 | #Note: It only works on Integer-type (numerical attributes) 149 | elif(command.startswith("minvalue(") and command.endswith(")")): 150 | if(cnt != 1): 151 | print("ERROR: Not Connected") 152 | else: 153 | try: 154 | abc = command[9:-1].strip() 155 | if(len(abc) != 0): 156 | l1 = abc.split(",") 157 | if(len(l1) == 2): 158 | tname = str(l1[0]) 159 | attr = str(l1[1]) 160 | 161 | c.execute("SELECT MIN("+attr+") FROM " + tname) 162 | ans = list(c.fetchone()) 163 | ans = str(ans).strip('[]') 164 | print("Min : " + ans) 165 | del ans, tname, attr, l1 166 | else: 167 | print("Error: There should be only two parameters") 168 | else: 169 | print("ERROR: Please Enter the command correctly") 170 | 171 | del abc 172 | except: 173 | print("ERROR: Please Enter the parameters correctly") 174 | 175 | # Average Value of an Attribute in Table 176 | #Note: It only works on Integer-type (numerical attributes) 177 | elif(command.startswith("avgvalue(") and command.endswith(")")): 178 | if(cnt != 1): 179 | print("ERROR: Not Connected") 180 | else: 181 | try: 182 | abc = command[9:-1].strip() 183 | if(len(abc) != 0): 184 | l1 = abc.split(",") 185 | if(len(l1) == 2): 186 | tname = str(l1[0]) 187 | attr = str(l1[1]) 188 | 189 | c.execute("SELECT AVG("+attr+") FROM " + tname) 190 | ans = list(c.fetchone()) 191 | ans = str(ans).strip('[]') 192 | print("Average : " + ans) 193 | del ans, tname, attr, l1 194 | else: 195 | print("Error: There should be only two parameters") 196 | else: 197 | print("ERROR: Please Enter the command correctly") 198 | 199 | del abc 200 | except: 201 | print("ERROR: Please Enter the parameters correctly") 202 | 203 | #replace Function added to replace all the occurences with another string 204 | elif(command.startswith("replace(") and command.endswith(")")): 205 | if(cnt != 1): 206 | print("ERROR: Not Connected") 207 | else: 208 | try: 209 | abc = command[8:-1].upper().strip() 210 | if(len(abc) != 0): 211 | l1 = abc.split(",") 212 | if(len(l1) == 3): 213 | full_str = str(l1[0]) 214 | st1 = str(l1[1]) 215 | st2 = str(l1[2]) 216 | 217 | c.execute("SELECT REPLACE('"+full_str+"','"+st1+"','"+st2+"')") 218 | 219 | ans = list(c.fetchone()) 220 | ans = str(ans).strip('[]') 221 | print("FINAL STRING : " + ans) 222 | del ans, full_str,st1,st2, l1 223 | else: 224 | print("Error: There should be only three parameters") 225 | else: 226 | print("ERROR: Please Enter the command correctly") 227 | 228 | del abc 229 | except: 230 | print("ERROR: Please Enter the parameters correctly") 231 | 232 | 233 | 234 | 235 | 236 | elif(command.startswith("length(") and command.endswith(")")): 237 | if(cnt != 1): 238 | print("ERROR: Not Connected") 239 | else: 240 | abc = command[7:-1].strip() 241 | if (len(abc) != 0): 242 | l1 = abc.split(",") 243 | if(len(l1) == 1): 244 | s = str(l1[0]) 245 | s = int(len(s)) 246 | print(s) 247 | 248 | else: 249 | print("ERROR: There should only be one parameter") 250 | 251 | else: 252 | print("ERROR: Please Enter the command correctly") 253 | 254 | 255 | # Insert Values into Table 256 | elif(command.startswith("insertvalues(") and command.endswith(")")): 257 | if(cnt != 1): 258 | print("ERROR: Not Connected !!") 259 | else: 260 | abc = command[13:-1].upper().strip() 261 | if(len(abc) != 0): 262 | l1 = abc.split(",") 263 | if(len(l1) >= 2): 264 | tname = str(l1[0]) 265 | a = [] 266 | for i in range(1, len(l1)): 267 | a.insert(i-1, str(l1[i]).lower().strip()) 268 | at = tuple(a) 269 | try: 270 | c.execute("INSERT INTO "+tname +" VALUES(NULL,?"+",?"*(len(l1)-1)+")", (usern,)+at) 271 | db.commit() 272 | print("One row inserted.") 273 | except: 274 | print("ERROR!! Invalid Entry!") 275 | del at, a, tname 276 | else: 277 | print("ERROR!! There should be atleast two Parameters!") 278 | del l1 279 | else: 280 | print("ERROR!! Please Enter the Table name!") 281 | del abc 282 | # Create New User 283 | elif(command.startswith("createuser(") and command.endswith(")")): 284 | if(cnt != 1): 285 | print("ERROR: Not Authorized !!") 286 | elif(usern == "system"): 287 | abc = command[11:-1].lower().strip() 288 | if(len(abc) != 0): 289 | l1 = abc.split(",") 290 | if(len(l1) == 2): 291 | l1[0] = l1[0].strip() 292 | l1[1] = l1[1].strip() 293 | at = tuple(l1) 294 | try: 295 | cu.execute("INSERT INTO USERS VALUES(NULL,?,?)", at) 296 | dbu.commit() 297 | print("User Created.") 298 | except: 299 | print("ERROR!! Invalid Entry!") 300 | del at 301 | else: 302 | print("ERROR!! There should be two Parameters!") 303 | del l1 304 | else: 305 | print("ERROR!! Please Enter the Table name!") 306 | del abc 307 | else: 308 | print("ERROR: Not Authorized !!") 309 | # Delete Existing User 310 | elif(command.startswith("deleteuser(") and command.endswith(")")): 311 | if(cnt != 1): 312 | print("ERROR: Not Authorized !!") 313 | elif(usern == "system"): 314 | abc = command[11:-1].lower().strip() 315 | if(len(abc) != 0): 316 | l1 = abc.split(",") 317 | if(len(l1) == 1): 318 | l1[0] = l1[0].strip() 319 | at = tuple(l1) 320 | try: 321 | cu.execute("DELETE FROM USERS WHERE user= ?", at) 322 | dbu.commit() 323 | print("User Deleted.") 324 | except: 325 | print("ERROR!! Invalid Entry!") 326 | del at 327 | else: 328 | print("ERROR!! There should be one Parameters!") 329 | del l1 330 | else: 331 | print("ERROR!! Please Enter the Table name!") 332 | del abc 333 | else: 334 | print("ERROR: Not Authorized !!") 335 | # Show Schema 336 | elif(command.startswith("showtable(") and command.endswith(")")): 337 | if(cnt != 1): 338 | print("ERROR: Not Connected !!") 339 | else: 340 | abc = command[10:-1].upper().strip() 341 | if(len(abc) != 0): 342 | try: 343 | c.execute("pragma table_info('"+abc+"')") 344 | abv = c.fetchall() 345 | if(len(abv) > 0): #Added Condition check, whether abv object contains something 346 | print(" cid\t name\t pk") 347 | print("----------\t--------\t---------") 348 | for p, q, r, s, t, u in abv: 349 | print(" "*(10-len(str(p)))+str(p)+"\t"+" " *(8-len(str(q)))+str(q)+"\t"+" "*(9-len(str(u)))+str(u)) 350 | print("") 351 | else: #Else Table not found in database 352 | print("Table Not Found!") 353 | 354 | except: 355 | print("ERROR!! Please Enter the correct table!") 356 | else: 357 | print("ERROR!! Please Enter the Table name!") 358 | 359 | del abc #Added 360 | 361 | 362 | 363 | 364 | 365 | 366 | #Count the number of rows/records in a Table 367 | elif(command.startswith("counttable(") and command.endswith(")")): 368 | if(cnt != 1): 369 | print("ERROR: Not Connected !!") 370 | else: 371 | abc = command[11:-1].strip() 372 | if(len(abc) != 0): 373 | l1= abc.split(",") 374 | if(len(l1) == 1): 375 | tname = str(l1[0]) 376 | try: 377 | c.execute("SELECT COUNT(*) FROM " + tname) 378 | ans = list(c.fetchone()) 379 | print(str(ans).strip('[]') + " Record(s)") 380 | del l1, tname, ans 381 | except: 382 | print("NO TABLE FOUND") 383 | else: 384 | print("ERROR!! Please Enter the Table name!") 385 | del abc 386 | 387 | 388 | 389 | # Show Values In Table 390 | elif(command.startswith("showvalues(") and command.endswith(")")): 391 | if(cnt != 1): 392 | print("ERROR: Not Connected !!") 393 | else: 394 | try: 395 | abc = command[11:-1].upper().strip() 396 | if(len(abc) != 0): 397 | c.execute("pragma table_info('"+abc+"')") 398 | abv = c.fetchall() 399 | for p, q, r, s, t, u in abv: 400 | print(" "*(9-len(str(q)))+str(q), end="\t") 401 | print("") 402 | 403 | for p, q, r, s, t, u in abv: 404 | print("---------", end="\t") 405 | print("") 406 | 407 | c.execute("SELECT * FROM "+abc) 408 | tables = c.fetchall() 409 | for i in tables: 410 | for j in i: 411 | print(" "*(9-len(str(j)))+str(j), end="\t") 412 | print("") 413 | ''' 414 | c.execute("SELECT name FROM sqlite_master WHERE type='table';") 415 | tables = c.fetchall() 416 | for table_name in tables: 417 | table_name = table_name[0] 418 | table = pd.read_sql_query("SELECT * from %s" % table_name, db) 419 | table.to_csv(path+table_name +'.csv', index=None) 420 | pdr = pd.read_csv(path+abc+'.csv') 421 | print(pdr) 422 | del pdr 423 | ''' 424 | else: 425 | print("ERROR!! Please Enter the Table name!") 426 | del abc 427 | except: 428 | print("ERROR!! Table Not Found!") 429 | # Delete Rows Either with Condition or Truncate Table 430 | elif(command.startswith("deletetable(") and command.endswith(")")): 431 | if (cnt != 1): 432 | print("ERROR: Not Connected !!") 433 | else: 434 | abc = command[12:-1] 435 | if (len(abc) != 0): 436 | l1 = abc.split(",") 437 | if(len(l1) == 1): 438 | tname = l1[0].strip().upper() 439 | try: 440 | c.execute("DELETE FROM "+tname) 441 | db.commit() 442 | #os.system("IF EXIST C:\AmbSQL\\" + tname +".csv " + "DEL /F C:\AmbSQL\\" + tname + ".csv") 443 | print("All Rows Deleted.") 444 | except: 445 | print("ERROR!! Invalid Table name!") 446 | del tname 447 | elif(len(l1) == 2): 448 | tname = l1[0].strip().upper() 449 | drow = l1[1].lower() 450 | dd = drow.split("==") 451 | if(len(dd) == 2): 452 | col = dd[0].strip() 453 | if(col=='id'): 454 | valued = dd[1].strip() 455 | else: 456 | valued = str(dd[1]).strip() 457 | try: 458 | if(col=='id'): 459 | c.execute("DELETE FROM "+tname +" WHERE "+col+"="+valued+";") 460 | else: 461 | c.execute("DELETE FROM "+tname + " WHERE "+col+" = '"+valued+"';") 462 | db.commit() 463 | #os.system("IF EXIST C:\AmbSQL\\" + tname + ".csv " + "DEL /F C:\AmbSQL\\" + tname + ".csv") 464 | print("Row(s) Deleted.") 465 | except: 466 | print("ERROR!! Invalid Parameters!") 467 | del col, valued 468 | else: 469 | print("ERROR!! Invalid Equivalence of Row and Value!") 470 | del dd, drow, tname 471 | else: 472 | print("ERROR!! Entry should contain one or two parameters!") 473 | del l1 474 | else: 475 | print("ERROR!! Entry should have atleast one parameter!") 476 | del abc 477 | # Update Values in Table either with condition or with no condition 478 | elif(command.startswith("updatevalue(") and command.endswith(")")): 479 | if (cnt != 1): 480 | print("ERROR: Not Connected !!") 481 | else: 482 | abc = command[12:-1] 483 | if(len(abc) != 0): 484 | l1 = abc.split(",") 485 | if(len(l1) == 2): 486 | tname = l1[0].strip() 487 | dd = l1[1].split("=") 488 | if(len(dd)==2): 489 | col = dd[0].strip() 490 | valued = str(dd[1]).strip() 491 | try: 492 | c.execute("UPDATE "+tname+" SET "+col+"='"+valued+"';") 493 | db.commit() 494 | print("Row(s) Updated.") 495 | except: 496 | print("ERROR!! Invalid Parameters!") 497 | del col, valued 498 | else: 499 | print("ERROR!! Invalid Entry!") 500 | elif(len(l1)==3): 501 | tname = l1[0].strip() 502 | dd = l1[1].split("=") 503 | if(len(dd) == 2): 504 | col = dd[0].strip() 505 | valued = str(dd[1]).strip() 506 | dd1 = l1[2].split("==") 507 | if(len(dd1)==2): 508 | col1 = dd1[0].strip() 509 | if(col1=='id'): 510 | valued1 = dd1[1].strip() 511 | else: 512 | valued1 = str(dd1[1]).strip() 513 | try: 514 | if(col1=='id'): 515 | c.execute("UPDATE "+tname+" SET "+col+"='"+valued+"' WHERE id= ?", (valued1)) 516 | else: 517 | c.execute("UPDATE "+tname+" SET "+col+"='"+valued+"' WHERE "+col1+"='"+valued1+"';") 518 | db.commit() 519 | print("Row Updated.") 520 | except: 521 | print("ERROR!! Invalid Parameters!") 522 | del col1, valued1 523 | else: 524 | print("ERROR!! Invalid Equivalence of Row and Value!") 525 | del col, valued, dd1 526 | else: 527 | print("ERROR!! Invalid Entry!") 528 | del tname, dd 529 | else: 530 | print("ERROR!! Entry should contain two or three parameters!") 531 | del l1 532 | else: 533 | print("ERROR!! Entry should have atleast two parameter!") 534 | del abc 535 | # Clear the Screen 536 | elif(command == "clear()"): 537 | if(cnt != 1): 538 | print("ERROR: Not Connected !!") 539 | else: 540 | main(1) 541 | # Documentation 542 | elif(command == "docs()"): 543 | print("") 544 | print("Copyright (c) 2020, Ambuj. All rights reserved.") 545 | print("") 546 | print("\tconnect - To login to Database") 547 | print("\tcreatetable(, , , ....) - To create new Table") 548 | print("\tinsertvalues(, , , ...) - To enter the values in Table") 549 | print("\tshowtable() - To show the Table schema") 550 | print("\tshowvalues() - To show the Table values") 551 | print("\tupdatevalue( , ) - To Update all values of column") 552 | print("\tupdatevalue( , , ) - To Update the values of column") 553 | print("\tdeletetable() - To truncate the Table") 554 | print("\tdeletetable( , )(e.g- deletetable(ab,name==jack))- To delete row(s) from Table") 555 | print("\tcounttable() - To count the rows/records of Table") #Documentation Updated for count() 556 | print("\tsumvalue(, ) - To sum of records of particular attribute of Table") #Function Added 557 | print("\tmaxvalue(, ) - To find the max value of particular attribute of Table") #Function Added 558 | print("\tminvalue(, ) - To find the min value of particular attribute of Table") #Function Added 559 | print("\tavgvalue(, ) - To find the average value of particular attribute of Table") #Function Added 560 | print("\tdroptable() - To drop the Table") 561 | print("\tcounttable() - To count the rows/records of Table") #Documentation Updated for count() 562 | #print("\ttolower() - To change the string to lower case") 563 | #print("\ttoupper() - To change the string to upper case") 564 | print("\taltertable( , ) - To rename Table Name") 565 | print("\tcreateuser( , ) - To create new User") 566 | #print("\ttoday() - To fetch the current date") 567 | #print("\treplace(,,) - To replace all occurrences of a specified string with another string") 568 | #print("\tlength() - To fetch the length of a string") 569 | #print("\tsubstr(,,) - To fetch a substring from a string starting at a specified position with a predefined length") 570 | print("\tdeleteuser() - To delete a User") 571 | print("\tlogout() - To Logout") 572 | print("\tclear() - To clear the Screen") 573 | print("") 574 | print("\tnote=> Username: 'system', password: '123'") 575 | # Alter Table Name 576 | elif(command.startswith("altertable(") and command.endswith(")")): 577 | if(cnt != 1): 578 | print("ERROR: Not Connected !!") 579 | else: 580 | abc = command[11:-1].upper() 581 | try: 582 | if(len(abc) != 0): 583 | l1 = abc.split(",") 584 | if(len(l1) == 2): 585 | old1 = l1[0].strip() 586 | new1 = l1[1].strip() 587 | c.execute("ALTER TABLE "+old1 +" RENAME TO "+new1) 588 | db.commit() 589 | #os.system("IF EXIST C:\AmbSQL\\"+old1 +".csv "+"DEL /F C:\AmbSQL\\"+old1+".csv") 590 | print("Table name Updated from " + 591 | old1+" to "+new1) 592 | del old1, new1 593 | else: 594 | print("ERROR!! There should be two Parameters!") 595 | else: 596 | print("ERROR!! Please Enter the Table names!") 597 | except: 598 | print("ERROR!! Invalid Table Name!") 599 | del abc 600 | # Drop Table 601 | elif(command.startswith("droptable(") and command.endswith(")")): 602 | if (cnt != 1): 603 | print("ERROR: Not Connected !!") 604 | else: 605 | abc = command[10:-1].upper().strip() 606 | if(len(abc) != 0): 607 | try: 608 | c.execute("DROP TABLE "+abc) 609 | db.commit() 610 | #os.system("IF EXIST C:\AmbSQL\\" + abc +".csv " + "DEL /F C:\AmbSQL\\" + abc + ".csv") 611 | print("Table Dropped.") 612 | except: 613 | print("ERROR!! Invalid Table Name!") 614 | else: 615 | print("ERROR!! Please Enter the Table name!") 616 | del abc 617 | # Logout From Current Session 618 | elif(command == "logout()"): 619 | cnt = 0 620 | print("Successfully Logged Out.") 621 | else: 622 | print("Command not found!!(please ensure you include '()' at the end)") 623 | # Handle KeyBoard Interrupt 624 | except KeyboardInterrupt: 625 | print("KEYBOARD INTERRUPT") 626 | dbu.close() 627 | db.close() 628 | if(os.name=='nt'): 629 | os.system("cls") 630 | else: 631 | os.system("clear") 632 | sys.exit(0) 633 | # Call the main function 634 | if __name__ == '__main__': 635 | main(0) 636 | -------------------------------------------------------------------------------- /AmbSql.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AmbSQL RDBMS 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 200 | 201 | 202 | 203 | 223 | 224 |
225 |

AmbSQL

226 |

Fast Pace DB management opensource Software

227 | 228 |
229 |
230 | 233 |
234 | 237 |
238 |
239 |
240 |
241 | 242 | 243 |
244 |
245 |
246 |

About US


247 |

AmbSQL is a Relational Database Management System which created with keeping in focus the speed and the ease to operate on.


248 |

Made With ❤ in Python3

249 |
250 |
251 |
252 | 253 |
254 |
255 |
256 | 257 |
258 |
259 |
260 | 261 |
262 |
263 |

Documentation


264 | For AmbSQL Command Line Interface:

265 |
  • To login to Database : connect
  • 266 |
  • To create new Table :createtable(<table-name>, <column1-name> , <column2-name>, ....)
  • 267 |
  • To enter the values in Table:insertvalues(<table_name>, <column1-value> , <column2-value>, ...)
  • 268 |
269 |
Refer our whole documentation at Link
270 |

This program is compatible only with python - 3.x

271 |
272 |
273 |
274 | 275 | 276 |
277 |

Features of AmbSQL

278 |
279 |
280 |
281 | 282 |

Power

283 |

Fast speedy operations to be performed

284 |
285 |
286 | 287 |

Love for Py3

288 |

Made with love of favourite opensource language python

289 |
290 |
291 | 292 |

Ease of DMBS management

293 |

DBMS task demystified

294 |
295 |
296 | 297 |
298 |
299 |
300 | 301 |
302 |

Installation


303 |

For Command-line Interface:

304 |
  • Download the AmbSQL.exe here and run it on Your PC.
  • 305 |
  • AmbSQL can also be downloaded from https://ambujraj.github.io/AmbSQL/download/.
  • 306 |


307 | 308 | For Python Package:

309 |
  • Using pip: $ pip install ambsql
  • 310 |
  • Manually using CLI:
    • git clone https://github.com/ambujraj/AmbSQL.git
    • cd AmbSQL
    • sudo python3 setup.py install (Linux and MacOS) or python setup.py install (Windows)
  • 311 |
  • Manually using UI: Go to the repo on github => Click on 'Clone or Download' => Click on 'Download ZIP' and save it on your local disk.
  • 312 |
313 |
Refer our whole installation and usuage guide at Link


314 |

This program is compatible only with python - 3.x

315 |
316 |
317 | 318 |
319 |
320 |
321 | 322 | 323 | 324 |
325 |

Help Us Improve

326 |

You can suggest us of new improvements you want by creating new Issue here

327 |
328 | 329 | 330 | 336 | 337 | 373 | 374 | 375 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # CONTRIBUTING.md 2 | 3 | ## Steps to follow :scroll: 4 | 5 | ### 1. Fork it :fork_and_knife: 6 | 7 | You can get your own fork/copy of [AmbSQL](https://github.com/ambujraj/AmbSQL) by using the Fork button or clicking [this](https://github.com/ambujraj/AmbSQL/new/master?readme=1#fork-destination-box). 8 | 9 | [![Fork Button](https://help.github.com/assets/images/help/repository/fork_button.jpg)](https://github.com/ambujraj/AmbSQL) 10 | 11 | ### 2. Clone it :busts_in_silhouette: 12 | 13 | You need to clone (download) it to local machine using 14 | 15 | ```sh 16 | git clone https://github.com/Your_Username/AmbSQL.git 17 | ``` 18 | 19 | > This makes a local copy of repository in your machine. 20 | 21 | Once you have cloned the `AmbSQL` repository in Github, move to that folder first using change directory command on linux and Mac. 22 | 23 | ```sh 24 | # This will change directory to a folder AmbSQL 25 | cd AmbSQL 26 | ``` 27 | 28 | Move to this folder for all other commands. 29 | 30 | ### 3. Set it up :arrow_up: 31 | 32 | Run the following commands to see that *your local copy* has a reference to *your forked remote repository* in Github :octocat: 33 | 34 | ```sh 35 | git remote -v 36 | origin https://github.com/Your_Username/AmbSQL.git (fetch) 37 | origin https://github.com/Your_Username/AmbSQL.git (push) 38 | ``` 39 | 40 | Now, lets add a reference to the original [AmbSQL](https://github.com/ambujraj/AmbSQL) repository using 41 | 42 | ```sh 43 | git remote add upstream https://github.com/ambujraj/AmbSQL.git 44 | ``` 45 | 46 | > This adds a new remote named ***upstream***. 47 | 48 | See the changes using 49 | 50 | ```sh 51 | git remote -v 52 | origin https://github.com/Your_Username/AmbSQL.git (fetch) 53 | origin https://github.com/Your_Username/AmbSQL.git (push) 54 | upstream https://github.com/ambujraj/AmbSQL.git (fetch) 55 | upstream https://github.com/ambujraj/AmbSQL.git (push) 56 | ``` 57 | 58 | ### 4. Sync it :recycle: 59 | 60 | Always keep your local copy of repository updated with the original repository. 61 | Before making any changes and/or in an appropriate interval, run the following commands *carefully* to update your local repository. 62 | 63 | ```sh 64 | # Fetch all remote repositories and delete any deleted remote branches 65 | git fetch --all --prune 66 | 67 | # Switch to `master` branch 68 | git checkout master 69 | 70 | # Reset local `master` branch to match `upstream` repository's `master` branch 71 | git reset --hard upstream/master 72 | 73 | # Push changes to your forked `AmbSQL` repo 74 | git push origin master 75 | ``` 76 | 77 | ### 5. Ready Steady Go... :turtle: :rabbit2: 78 | 79 | Once you have completed these steps, you are ready to start contributing by checking our Open Issues and creating [pull requests](https://github.com/ambujraj/AmbSQL/pulls). 80 | 81 | ### 6. Create a new branch :bangbang: 82 | 83 | Whenever you are going to make contribution. Please create seperate branch using command and keep your `master` branch clean (i.e. synced with remote branch). 84 | 85 | ```sh 86 | # It will create a new branch with name Branch_Name and switch to branch Branch_Name 87 | git checkout -b Branch_Name 88 | ``` 89 | 90 | Create a seperate branch for contibution and try to use same name of branch as of folder. 91 | 92 | To switch to desired branch 93 | 94 | ```sh 95 | # To switch from one folder to other 96 | git checkout Branch_Name 97 | ``` 98 | 99 | To add the changes to the branch. Use 100 | 101 | ```sh 102 | # To add all files to branch Folder_Name 103 | git add . 104 | ``` 105 | 106 | Type in a message relevant for the code reveiwer using 107 | 108 | ```sh 109 | # This message get associated with all files you have changed 110 | git commit -m 'relevant message' 111 | ``` 112 | 113 | Now, Push your awesome work to your remote repository using 114 | 115 | ```sh 116 | # To push your work to your remote repository 117 | git push -u origin Branch_Name 118 | ``` 119 | 120 | Finally, go to your repository in browser and click on `compare and pull requests`. 121 | Then add a title and description to your pull request that explains your precious effort. 122 | 123 | :tada: :confetti_ball: :smiley: _**Happy Contributing**_ :smiley: :confetti_ball: :tada: 124 | -------------------------------------------------------------------------------- /CREDITS: -------------------------------------------------------------------------------- 1 | This is a partial credits file of people that have contributed to the AmbSQL project. 2 | The fields are: Name (N), Email (E), About (A), Web Address (W), Location (L). 3 | Thanks. 4 | 5 | Ambuj 6 | ------------ 7 | N: Rinki Nag 8 | E: rinkinag24@gmail.com 9 | A: AI engineer at fractal 10 | W: 11 | L: Mumbai 12 | 13 | N: Aayank Singhai 14 | E: aayanksinghai02@gmail.com 15 | A: I am an undergraduate student exploring different domains of Computer Science. 16 | W: Nil 17 | L: Indore, India 18 | 19 | -------------------------------------------------------------------------------- /Code_Of_Conduct.md: -------------------------------------------------------------------------------- 1 | ## Contributor Covenant Code of Conduct 2 | 3 | > The code of conduct helps to welcome all people to contribute and pledges in return to value them as whole human beings and to foster an atmosphere of kindness, cooperation, and understanding. 4 | 5 | ### Our Pledge 6 | 7 | We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. 8 | 9 | We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. 10 | 11 | ### Our Standards 12 | 13 | Examples of behavior that contributes to a positive environment for our community include: 14 | 15 | - Demonstrating empathy and kindness toward other people 16 | - Being respectful of differing opinions, viewpoints, and experiences 17 | - Giving and gracefully accepting constructive feedback 18 | - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience 19 | - Focusing on what is best not just for us as individuals, but for the overall community 20 | 21 | Examples of unacceptable behavior include: 22 | 23 | - The use of sexualized language or imagery, and sexual attention or advances of any kind 24 | - Trolling, insulting or derogatory comments, and personal or political attacks 25 | - Public or private harassment 26 | - Publishing others’ private information, such as a physical or email address, without their explicit permission 27 | - Other conduct which could reasonably be considered inappropriate in a professional setting 28 | 29 | ### Our Resposibilities 30 | 31 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 32 | 33 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 34 | 35 | ### Scope 36 | 37 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 38 | 39 | ### Enforcement 40 | 41 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project admin responsible for enforcement at thecoderguy@outlook.com, or directly contacting project team members via email or Slack. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 42 | 43 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 44 | 45 | ### Attribution 46 | 47 | This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 48 | 49 | For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq 50 | -------------------------------------------------------------------------------- /Documentation.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | AmbSQL RDBMS 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 34 | 35 |
36 |

AmbSQL

37 |

Fast Pace DB management opensource Software

38 |

DOCUMENTATION

39 | 40 |
41 |
42 | 45 |
46 | 49 |
50 |
51 |
52 |
53 |
54 |

AmbSQL Command Line Interface

55 | 56 |

For AmbSQL Command Line Interface

57 |

58 |

    59 |
  • To login to Database

    connect

  • 60 |
  • To create new Table

    createtable(< table-name>, < column1-name> , < column2-name>, ....)

  • 61 |
  • To enter the values in Table

    insertvalues(< table_name>, < column1-value> , < column2-value>, ...)

  • 62 |
  • To show the Table schema

    showtable(< table_name>)

  • 63 |
  • To show the Table values

    showvalues(< table_name>)

  • 64 |
  • To Update all values of column

    updatevalue(< table_name> , < assignment>)

  • 65 |
  • To Update the values of column

    updatevalue(< table_name> , < assignment> , < condition>)(e.g- updateTable(ab, name=jack, age=23))

  • 66 |
  • To truncate the Table

    deletetable(< table_name>)

  • 67 |
  • To delete row(s) from Table

    deletetable(< table_name> , < condition>)(e.g- deletetable(ab,name==jack))

  • 68 |
  • To drop the Table

    droptable()

  • 69 |
  • To rename Table Name

    altertable(< old-table_name> , < new-table_name>)

  • 70 |
  • To create new User

    createuser(< user_name> , < password>)

  • 71 |
  • To delete a User

    deleteuser(< user_name>)

  • 72 |
  • To Logout

    logout()

  • 73 |
  • To clear the Screen

    clear()

  • 74 |
75 |

76 |
77 | 78 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Ambuj 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.md 2 | include requirements.txt -------------------------------------------------------------------------------- /PR_template.md: -------------------------------------------------------------------------------- 1 | ## Fixes issue 2 | Closes: #issue_number 3 | Addresses: #issue_number (if multiple persons are assigned, the issue) 4 | 5 | ## Proposed changes 6 | Brief description of what is fixed or changed 7 | 8 | 9 | ## Description 10 | 11 | 12 | 13 | ## Types of changes 14 | 15 | - [ ] Bug fix (non-breaking change which fixes an issue) 16 | - [ ] New feature (non-breaking change which adds functionality) 17 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 18 | - [ ] Documentation update (Documentation content changed) 19 | - [ ] Other (please describe): 20 | 21 | 22 | ## Checklist 23 | 24 | 25 | - [ ] My code follows the code style of this project. 26 | - [ ] My change requires a change to the documentation. 27 | - [ ] I have updated the documentation accordingly. 28 | - [ ] I have performed a self-review of my own code 29 | - [ ] My changes generate no new warnings 30 | 31 | ## Screenshots (if appropriate) 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![ambsql](images/Screenshot.PNG) 2 |
3 | # AmbSQL 4 | * AmbSQL is a Relational Database Management System which created with keeping in focus the speed and the ease to operate on. 5 | * Made With ❤ in Python3 6 | 7 | Take a look at our [website](https://ambujraj.github.io/AmbSQL/homepage/) 8 | 9 | # Documentation 10 | > Please refer to the documentation at https://github.com/ambujraj/AmbSQL/wiki/Documentation 11 | 12 | # Compatibility 13 | > This program is compatible with python - 3.x 14 | 15 | # Installation 16 | ## For Command-line Interface 17 | * Download the AmbSQL.exe file from https://github.com/ambujraj/AmbSQL/releases and run it on Your PC.
18 | * AmbSQL can also be downloaded from https://ambujraj.github.io/AmbSQL/download/. 19 | 20 | ## For Python Package 21 | You can use one of the below methods to download and use this repository.

22 | Using pip:
23 | `$ pip install ambsql`

24 | Manually using CLI:
25 | `$ git clone https://github.com/ambujraj/AmbSQL.git`
26 | `$ cd AmbSQL`
27 | `$ sudo python3 setup.py install (Linux and MacOS)`
28 | `$ python setup.py install (Windows)`

29 | Manually using UI:
30 | Go to the [repo on github](https://github.com/ambujraj/AmbSQL) => Click on 'Clone or Download' => Click on 'Download ZIP' and save it on your local disk. 31 | 32 | # Usage 33 | If installed CLI, open the AmbSQL.exe file and get the work started.

34 | If installed using pip or CLI:
35 | `$ python` (Windows) 36 |
or
37 | `$ python3` (Linux or MacOS)
38 | `>>>from ambsql import *`

39 | If installed using UI, unzip the file downloaded, go to the 'AmbSQL' directory and use one of the below commands:
40 | `$ python3 AmbSQL.py` (Linux or MacOS) 41 |
or
42 | `$ python AmbSQL.py` (Windows) 43 | 44 | # Examples 45 | If you installed package using pip or CLI, below is the sample code:
46 | `from ambsql import *`
47 | `createtable('studenttable', 'name', 'age')`
48 | `insertvalues('studenttable', 'Jack', 21)`
49 | `showvalues('studenttable')`

50 | If you installed AmbSQL.exe, below is the sample code:
51 | `> connect`
52 | `> createtable(studenttable, name, age)`
53 | `> insertvalues(studenttable, Jack, age)`
54 | `> showvalues(studenttable)` 55 | 56 | # Contributors 57 | > Check the list of contributors [here](https://github.com/ambujraj/AmbSQL/blob/master/CREDITS) 58 | 59 | # Help Us Improve 60 | > You can suggest us of new improvements you want by creating new Issue [here](https://github.com/ambujraj/AmbSQL/issues) 61 | 62 | ## Important Notice 63 | 64 | **AmbSQL** has been selected at [GirlScript Summer of Code 2021](https://www.gssoc.tech/)!!! 65 |

66 | 67 |

68 | 69 | ## 👨 Project Admin 70 | - Ambuj Raj

[](https://github.com/ambujraj) [](https://www.linkedin.com/in/ambujraj/)

71 | 72 | ## 👬 Mentors 73 | 74 | Feel free to ask your queries!! 🙌 75 | 76 | ## Slack Channel 77 | 78 | - [#proj_ambsql](https://gssoc20.slack.com/messages/proj_ambsql) 79 | 80 | # License 81 | [MIT License](https://github.com/ambujraj/AmbSQL/blob/master/LICENSE) 82 | -------------------------------------------------------------------------------- /ambsql/__init__.py: -------------------------------------------------------------------------------- 1 | from ambsql.ambsql import * -------------------------------------------------------------------------------- /ambsql/ambsql.py: -------------------------------------------------------------------------------- 1 | import string 2 | import sqlite3 3 | import os 4 | if(os.name == 'nt'): 5 | try: 6 | os.system("IF NOT EXIST C:\AmbSQL MKDIR C:\AmbSQL") 7 | except: 8 | pass 9 | path = 'C:\\AmbSQL\\' 10 | else: 11 | try: 12 | os.system("mkdir -p DB") 13 | except: 14 | pass 15 | path = 'DB/' 16 | # Connect to Tables Database 17 | db = sqlite3.connect(path+"dtables.db") 18 | c = db.cursor() 19 | def createtable(tname="", *cols): 20 | x = list(cols) 21 | for s in range(len(cols)): 22 | x[s] = str(x[s]) 23 | y = tuple(x) 24 | del x 25 | c.execute("CREATE TABLE " + tname + " (id INTEGER PRIMARY KEY)") 26 | for j in y: 27 | c.execute("ALTER TABLE " + tname + " ADD " + j + " TEXT") 28 | db.commit() 29 | def insertvalues(tname="", *cols): 30 | x = list(cols) 31 | for s in range(len(cols)): 32 | x[s] = str(x[s]) 33 | y = tuple(x) 34 | del x 35 | c.execute("INSERT INTO "+tname +" VALUES(NULL"+",?"*(len(cols))+")", y) 36 | db.commit() 37 | def showtable(tname=""): 38 | c.execute("pragma table_info('"+tname+"')") 39 | abv = c.fetchall() 40 | print(" cid\t name\t pk") 41 | print("----------\t--------\t---------") 42 | for p, q, r, s, t, u in abv: 43 | print(" "*(10-len(str(p)))+str(p)+"\t"+" " *(8-len(str(q)))+str(q)+"\t"+" "*(9-len(str(u)))+str(u)) 44 | print("") 45 | def showvalues(tname=""): 46 | c.execute("pragma table_info('"+tname+"')") 47 | abv = c.fetchall() 48 | for p, q, r, s, t, u in abv: 49 | print(" "*(9-len(str(q)))+str(q), end="\t") 50 | print("") 51 | 52 | for p, q, r, s, t, u in abv: 53 | print("---------", end="\t") 54 | print("") 55 | 56 | c.execute("SELECT * FROM "+tname) 57 | tables = c.fetchall() 58 | for i in tables: 59 | for j in i: 60 | print(" "*(9-len(str(j)))+str(j), end="\t") 61 | print("") 62 | def deletetable(tname=""): 63 | c.execute("DELETE FROM "+tname) 64 | db.commit() 65 | 66 | def updatevalue(tname, colm, nval, conc, conv): 67 | colm = str(colm) 68 | conc = str(conc) 69 | if(colm!='id' and colm!='ID'): 70 | nval = str(nval) 71 | if(conc == 'id' or conc == 'ID'): 72 | conv = int(conv) 73 | c.execute("UPDATE "+tname+" SET "+colm+"='"+nval+"' WHERE id="+str(conv)) 74 | else: 75 | conv = str(conv) 76 | c.execute("UPDATE "+tname+" SET "+colm+"='" +nval+"' WHERE "+conc+"='"+conv+"';") 77 | else: 78 | nval = int(nval) 79 | if(conc == 'id' or conc == 'ID'): 80 | c.execute("UPDATE "+tname+" SET "+colm+"="+nval+" WHERE id="+str(conv)) 81 | else: 82 | c.execute("UPDATE "+tname+" SET "+colm+"=" + 83 | nval+" WHERE "+conc+"='"+conv+"';") 84 | db.commit() 85 | ''' 86 | def updatevalue(tname, colm, nval): 87 | colm = str(colm) 88 | if(colm!='id' and colm!='ID'): 89 | nval = str(nval) 90 | else: 91 | nval = int(nval) 92 | c.execute("UPDATE "+tname+" SET "+colm+"='"+nval+"';") 93 | db.commit() 94 | ''' 95 | def clear(): 96 | if(os.name=='nt'): 97 | os.system("cls") 98 | else: 99 | os.system("clear") 100 | def altertable(otname="", ntname=""): 101 | c.execute("ALTER TABLE "+otname +" RENAME TO "+ntname) 102 | db.commit() 103 | def droptable(tname=""): 104 | c.execute("DROP TABLE "+tname) 105 | db.commit() 106 | -------------------------------------------------------------------------------- /docs/README.rst: -------------------------------------------------------------------------------- 1 | Documents coming soon! -------------------------------------------------------------------------------- /download/css/style.css: -------------------------------------------------------------------------------- 1 | @import url(https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css); 2 | @import url(https://fonts.googleapis.com/css?family=Lato:300,400,700); 3 | body { 4 | font-family: 'Lato', sans-serif; 5 | background: #353535; 6 | color: #FFF; 7 | } 8 | .jumbotron h1 { 9 | color: #353535; 10 | } 11 | 12 | h2 { 13 | color: #BDC3C7; 14 | text-transform: uppercase; 15 | letter-spacing: 1px; 16 | } 17 | .wrapper{ 18 | width: 100%; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | } 24 | a.animated-button:link, a.animated-button:visited { 25 | position: relative; 26 | display: block; 27 | margin: 30px auto 0; 28 | padding: 14px 15px; 29 | color: #fff; 30 | font-size:14px; 31 | font-weight: bold; 32 | text-align: center; 33 | text-decoration: none; 34 | text-transform: uppercase; 35 | overflow: hidden; 36 | letter-spacing: .08em; 37 | border-radius: 0; 38 | text-shadow: 0 0 1px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(0, 0, 0, 0.2); 39 | -webkit-transition: all 1s ease; 40 | -moz-transition: all 1s ease; 41 | -o-transition: all 1s ease; 42 | transition: all 1s ease; 43 | } 44 | a.animated-button:link:after, a.animated-button:visited:after { 45 | content: ""; 46 | position: absolute; 47 | height: 0%; 48 | left: 50%; 49 | top: 50%; 50 | width: 150%; 51 | z-index: -1; 52 | -webkit-transition: all 0.75s ease 0s; 53 | -moz-transition: all 0.75s ease 0s; 54 | -o-transition: all 0.75s ease 0s; 55 | transition: all 0.75s ease 0s; 56 | } 57 | a.animated-button:link:hover, a.animated-button:visited:hover { 58 | color: #FFF; 59 | text-shadow: none; 60 | } 61 | a.animated-button:link:hover:after, a.animated-button:visited:hover:after { 62 | height: 450%; 63 | } 64 | a.animated-button:link, a.animated-button:visited { 65 | position: relative; 66 | display: block; 67 | margin: 30px auto 0; 68 | padding: 14px 15px; 69 | color: #fff; 70 | font-size:14px; 71 | border-radius: 0; 72 | font-weight: bold; 73 | text-align: center; 74 | text-decoration: none; 75 | text-transform: uppercase; 76 | overflow: hidden; 77 | letter-spacing: .08em; 78 | text-shadow: 0 0 1px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(0, 0, 0, 0.2); 79 | -webkit-transition: all 1s ease; 80 | -moz-transition: all 1s ease; 81 | -o-transition: all 1s ease; 82 | transition: all 1s ease; 83 | } 84 | a.animated-button.abc { 85 | border: 2px solid rgba(90, 77, 210,0.5); 86 | } 87 | a.animated-button.abc:after { 88 | background: rgba(90, 77, 210, 0.5); 89 | -moz-transform: translateX(-50%) translateY(-50%) rotate(25deg); 90 | -ms-transform: translateX(-50%) translateY(-50%) rotate(25deg); 91 | -webkit-transform: translateX(-50%) translateY(-50%) rotate(25deg); 92 | transform: translateX(-50%) translateY(-50%) rotate(25deg); 93 | } 94 | .non-select{ 95 | -webkit-touch-callout: none; 96 | -webkit-user-select: none; 97 | -khtml-user-select: none; 98 | -moz-user-select: none; 99 | -ms-user-select: none; 100 | user-select: none; 101 | } 102 | a.animated-button.def { 103 | border: 2px solid #b8c4d1; 104 | } 105 | -------------------------------------------------------------------------------- /download/ico/db.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ambujraj/AmbSQL/83329271e72184f90d6bc0b1eec195446bab81cf/download/ico/db.png -------------------------------------------------------------------------------- /download/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Download AmbSQL 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |

AmbSQL

17 |

A Relational Database Management System created with keeping in focus the speed and the ease to operate on.

18 | 19 |
20 |
21 |
22 | 23 |
24 |
25 |

Download

26 |
27 |
28 |
29 | 30 |
31 |
32 | 33 |
34 |
35 | 36 | 37 | -------------------------------------------------------------------------------- /homepage/ico/db.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ambujraj/AmbSQL/83329271e72184f90d6bc0b1eec195446bab81cf/homepage/ico/db.png -------------------------------------------------------------------------------- /homepage/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | AmbSQL RDBMS 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 192 | 193 | 194 | 195 | 215 | 216 |
217 |

AmbSQL

218 |

Fast Pace DB management opensource Software

219 | 220 |
221 |
222 | 225 |
226 | 229 |
230 |
231 |
232 |
233 | 234 | 235 |
236 |
237 |
238 |

About US


239 |

AmbSQL is a Relational Database Management System which created with keeping in focus the speed and the ease to operate on.


240 |

Made With ❤ in Python3

241 |
242 |
243 |
244 | 245 |
246 |
247 |
248 | 249 |
250 |
251 |
252 | 253 |
254 |
255 |

Documentation


256 |

For AmbSQL Command Line Interface:

257 |
  • To login to Database : connect
  • 258 |
  • To create new Table :createtable(, , , ....)
  • 259 |
  • To enter the values in Table:insertvalues(, , , ...)
  • 260 |
261 |
Refer our whole documentation at Link


262 |

This program is compatible only with python - 3.x

263 |
264 |
265 |
266 | 267 | 268 |
269 |

Features of AmbSQL

270 |
271 |
272 |
273 | 274 |

Power

275 |

Fast speedy operations to be performed

276 |
277 |
278 | 279 |

Love for Py3

280 |

Made with love of favourite opensource language python

281 |
282 |
283 | 284 |

Ease of DMBS management

285 |

DBMS task demystified

286 |
287 |
288 | 289 |
290 |
291 |
292 | 293 |
294 |

Installation


295 |

For Command-line Interface:

296 |
  • Download the AmbSQL.exe here and run it on Your PC.
  • 297 |
  • AmbSQL can also be downloaded from https://ambujraj.github.io/AmbSQL/download/.
  • 298 |


299 | 300 | For Python Package:

301 |
  • Using pip: $ pip install ambsql
  • 302 |
  • Manually using CLI:
    • git clone https://github.com/ambujraj/AmbSQL.git
    • cd AmbSQL
    • sudo python3 setup.py install (Linux and MacOS) or python setup.py install (Windows)
  • 303 |
  • Manually using UI: Go to the repo on github => Click on 'Clone or Download' => Click on 'Download ZIP' and save it on your local disk.
  • 304 |
305 |
Refer our whole installation and usuage guide at Link


306 |

This program is compatible only with python - 3.x

307 |
308 |
309 | 310 |
311 |
312 |
313 | 314 | 315 | 316 |
317 |

Help Us Improve

318 |

You can suggest us of new improvements you want by creating new Issue here

319 |
320 | 321 | 322 | 328 | 329 | 365 | 366 | 367 | 368 | -------------------------------------------------------------------------------- /ico.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ambujraj/AmbSQL/83329271e72184f90d6bc0b1eec195446bab81cf/ico.JPG -------------------------------------------------------------------------------- /images/Screenshot.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ambujraj/AmbSQL/83329271e72184f90d6bc0b1eec195446bab81cf/images/Screenshot.PNG -------------------------------------------------------------------------------- /images/db.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ambujraj/AmbSQL/83329271e72184f90d6bc0b1eec195446bab81cf/images/db.ico -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ambujraj/AmbSQL/83329271e72184f90d6bc0b1eec195446bab81cf/requirements.txt -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | universal = 1 3 | 4 | [metadata] 5 | description-file=README.md 6 | license_file = LICENSE 7 | home-page = https://github.com/ambujraj/AmbSQL 8 | platform = any 9 | author = Ambuj Raj 10 | author-email = thecoderguy@outlook.com 11 | 12 | [flake8] 13 | doctests = True 14 | exclude = .git, .eggs, __pycache__, download/, docs/, build/, dist/ 15 | 16 | [options] 17 | setup_requires = 18 | setuptools 19 | 20 | [pydocstyle] 21 | match-dir = (?!download)(?!docs)[^\.].* 22 | match = (?!AmbSQL)(?!setup)[^\._].*\.py 23 | inherit = false -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, find_packages 2 | from os import path 3 | with open("README.md", "r") as fh: 4 | long_description = fh.read() 5 | 6 | here = path.abspath(path.dirname(__file__)) 7 | 8 | # get the dependencies and installs 9 | with open(path.join(here, 'requirements.txt'), encoding='utf-8') as f: 10 | all_reqs = f.read().split('\n') 11 | 12 | install_requires = [x.strip() for x in all_reqs if 'git+' not in x] 13 | dependency_links = [x.strip().replace('git+', '') for x in all_reqs if x.startswith('git+')] 14 | 15 | 16 | setup( 17 | name="ambsql", 18 | version="1.1.5", 19 | author="Ambuj Raj", 20 | author_email="thecoderguy@outlook.com", 21 | description="AmbSQL is a DBMS which is approx 10x faster and the most EASY to operate on.", 22 | long_description=long_description, 23 | long_description_content_type="text/markdown", 24 | url="https://github.com/ambujraj/AmbSQL", 25 | classifiers=[ 26 | "Programming Language :: Python :: 3", 27 | "License :: OSI Approved :: MIT License", 28 | "Operating System :: OS Independent", 29 | ], 30 | packages=find_packages(exclude=['docs', 'download']), 31 | include_package_data=True, 32 | install_requires=install_requires, 33 | dependency_links=dependency_links, 34 | keywords='database management system python ambsql terminal command-line', 35 | ) 36 | -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font: 400 15px Lato, sans-serif; 3 | line-height: 1.8; 4 | color: #818181; 5 | } 6 | h2 { 7 | font-size: 24px; 8 | text-transform: uppercase; 9 | color: #303030; 10 | font-weight: 600; 11 | margin-bottom: 30px; 12 | } 13 | 14 | .one{ 15 | margin: 50px; 16 | } --------------------------------------------------------------------------------